smithycms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +142 -0
  3. data/Rakefile +27 -0
  4. data/app/assets/images/smithy/logo.png +0 -0
  5. data/app/assets/images/smithy/logo2.png +0 -0
  6. data/app/assets/javascripts/smithy/application.js +13 -0
  7. data/app/assets/javascripts/smithy/assets.js.coffee +35 -0
  8. data/app/assets/javascripts/smithy/guides.js +23 -0
  9. data/app/assets/javascripts/smithy/jquery-ui.min.js +5 -0
  10. data/app/assets/javascripts/smithy/nested_forms.js +55 -0
  11. data/app/assets/javascripts/smithy/page_contents.js +4 -0
  12. data/app/assets/javascripts/smithy/pages.js +41 -0
  13. data/app/assets/javascripts/smithy/settings.js +0 -0
  14. data/app/assets/javascripts/smithy/templates.js +25 -0
  15. data/app/assets/stylesheets/smithy/application.css.scss +29 -0
  16. data/app/assets/stylesheets/smithy/assets.css.scss +3 -0
  17. data/app/assets/stylesheets/smithy/bootstrap_and_overrides.css.scss +12 -0
  18. data/app/assets/stylesheets/smithy/content_blocks.css.scss +2 -0
  19. data/app/assets/stylesheets/smithy/forms.css.scss +3 -0
  20. data/app/assets/stylesheets/smithy/guides.css.scss +5 -0
  21. data/app/assets/stylesheets/smithy/layout.css.scss +113 -0
  22. data/app/assets/stylesheets/smithy/pages.css.scss +35 -0
  23. data/app/assets/stylesheets/smithy/templates.css.scss +14 -0
  24. data/app/controllers/smithy/assets_controller.rb +50 -0
  25. data/app/controllers/smithy/base_controller.rb +14 -0
  26. data/app/controllers/smithy/caches_controller.rb +13 -0
  27. data/app/controllers/smithy/content_blocks_controller.rb +50 -0
  28. data/app/controllers/smithy/content_pieces_controller.rb +97 -0
  29. data/app/controllers/smithy/contents_controller.rb +41 -0
  30. data/app/controllers/smithy/guides_controller.rb +9 -0
  31. data/app/controllers/smithy/images_controller.rb +41 -0
  32. data/app/controllers/smithy/page_contents_controller.rb +90 -0
  33. data/app/controllers/smithy/pages_controller.rb +110 -0
  34. data/app/controllers/smithy/settings_controller.rb +46 -0
  35. data/app/controllers/smithy/sitemap_controller.rb +13 -0
  36. data/app/controllers/smithy/templates_controller.rb +79 -0
  37. data/app/helpers/smithy/application_helper.rb +36 -0
  38. data/app/helpers/smithy/assets_helper.rb +9 -0
  39. data/app/helpers/smithy/pages_helper.rb +12 -0
  40. data/app/helpers/smithy/settings_helper.rb +4 -0
  41. data/app/helpers/smithy/templates_helper.rb +4 -0
  42. data/app/helpers/smithy/upload_helper.rb +110 -0
  43. data/app/models/smithy/asset.rb +64 -0
  44. data/app/models/smithy/content.rb +35 -0
  45. data/app/models/smithy/content_block.rb +41 -0
  46. data/app/models/smithy/content_block_template.rb +26 -0
  47. data/app/models/smithy/image.rb +41 -0
  48. data/app/models/smithy/page.rb +94 -0
  49. data/app/models/smithy/page_content.rb +62 -0
  50. data/app/models/smithy/page_list.rb +61 -0
  51. data/app/models/smithy/page_proxy.rb +63 -0
  52. data/app/models/smithy/setting.rb +6 -0
  53. data/app/models/smithy/site.rb +30 -0
  54. data/app/models/smithy/template.rb +53 -0
  55. data/app/models/smithy/template_container.rb +16 -0
  56. data/app/views/layouts/smithy/application.html.erb +27 -0
  57. data/app/views/layouts/smithy/guides.html.erb +16 -0
  58. data/app/views/layouts/smithy/modal.html.erb +10 -0
  59. data/app/views/layouts/smithy/shared/_flash.html.erb +6 -0
  60. data/app/views/layouts/smithy/shared/_footer.html.erb +3 -0
  61. data/app/views/layouts/smithy/shared/_head.html.erb +8 -0
  62. data/app/views/layouts/smithy/shared/_nav.html.erb +37 -0
  63. data/app/views/layouts/smithy/shared/_tail.html.erb +4 -0
  64. data/app/views/layouts/smithy/wide.html.erb +24 -0
  65. data/app/views/smithy/assets/_asset.html.erb +10 -0
  66. data/app/views/smithy/assets/_form.html.erb +13 -0
  67. data/app/views/smithy/assets/_upload_form.html.erb +13 -0
  68. data/app/views/smithy/assets/create.js.erb +5 -0
  69. data/app/views/smithy/assets/edit.html.erb +5 -0
  70. data/app/views/smithy/assets/index.html.erb +13 -0
  71. data/app/views/smithy/assets/new.html.erb +13 -0
  72. data/app/views/smithy/caches/show.html.erb +8 -0
  73. data/app/views/smithy/content_blocks/_content_block.html.erb +1 -0
  74. data/app/views/smithy/content_blocks/_secondary_nav.html.erb +12 -0
  75. data/app/views/smithy/content_blocks/_template_fields.html.erb +19 -0
  76. data/app/views/smithy/content_blocks/edit.html.erb +31 -0
  77. data/app/views/smithy/content_blocks/index.html.erb +17 -0
  78. data/app/views/smithy/content_blocks/new.html.erb +12 -0
  79. data/app/views/smithy/content_pieces/edit.html.erb +13 -0
  80. data/app/views/smithy/content_pieces/index.html.erb +21 -0
  81. data/app/views/smithy/content_pieces/new.html.erb +1 -0
  82. data/app/views/smithy/contents/_form.html.erb +6 -0
  83. data/app/views/smithy/contents/_form_fields.html.erb +12 -0
  84. data/app/views/smithy/contents/edit.html.erb +3 -0
  85. data/app/views/smithy/contents/new.html.erb +3 -0
  86. data/app/views/smithy/guides/markdown.html.erb +150 -0
  87. data/app/views/smithy/images/_form.html.erb +6 -0
  88. data/app/views/smithy/images/_form_fields.html.erb +28 -0
  89. data/app/views/smithy/images/edit.html.erb +3 -0
  90. data/app/views/smithy/images/new.html.erb +3 -0
  91. data/app/views/smithy/page_contents/edit.html.erb +18 -0
  92. data/app/views/smithy/page_contents/new.html.erb +28 -0
  93. data/app/views/smithy/page_lists/_form_fields.html.erb +6 -0
  94. data/app/views/smithy/pages/_container.html.erb +24 -0
  95. data/app/views/smithy/pages/_form.html.erb +57 -0
  96. data/app/views/smithy/pages/_page.html.erb +6 -0
  97. data/app/views/smithy/pages/_page_nav.html.erb +6 -0
  98. data/app/views/smithy/pages/_page_related.html.erb +21 -0
  99. data/app/views/smithy/pages/_parent.html.erb +10 -0
  100. data/app/views/smithy/pages/_root.html.erb +5 -0
  101. data/app/views/smithy/pages/edit.html.erb +7 -0
  102. data/app/views/smithy/pages/index.html.erb +17 -0
  103. data/app/views/smithy/pages/new.html.erb +7 -0
  104. data/app/views/smithy/settings/_form.html.erb +7 -0
  105. data/app/views/smithy/settings/_setting.html.erb +6 -0
  106. data/app/views/smithy/settings/edit.html.erb +3 -0
  107. data/app/views/smithy/settings/index.html.erb +9 -0
  108. data/app/views/smithy/settings/new.html.erb +3 -0
  109. data/app/views/smithy/settings/show.html.erb +10 -0
  110. data/app/views/smithy/sitemap/show.xml.erb +10 -0
  111. data/app/views/smithy/templates/_secondary_nav.html.erb +21 -0
  112. data/app/views/smithy/templates/_template.html.erb +1 -0
  113. data/app/views/smithy/templates/edit.html.erb +36 -0
  114. data/app/views/smithy/templates/index.html.erb +17 -0
  115. data/app/views/smithy/templates/new.html.erb +13 -0
  116. data/config/initializers/aws.rb +5 -0
  117. data/config/initializers/dragonfly.rb +48 -0
  118. data/config/initializers/formtastic.rb +77 -0
  119. data/config/initializers/kaminari_config.rb +10 -0
  120. data/config/initializers/liquid.rb +2 -0
  121. data/config/routes.rb +38 -0
  122. data/db/migrate/20120911193140_create_smithy_templates.rb +11 -0
  123. data/db/migrate/20120911203618_create_smithy_settings.rb +10 -0
  124. data/db/migrate/20121018182146_create_smithy_pages.rb +27 -0
  125. data/db/migrate/20121019145543_create_smithy_template_containers.rb +11 -0
  126. data/db/migrate/20121019160426_create_smithy_page_contents.rb +21 -0
  127. data/db/migrate/20121024213357_create_smithy_content_blocks.rb +10 -0
  128. data/db/migrate/20121025011733_create_smithy_content_block_templates.rb +12 -0
  129. data/db/migrate/20121029175812_create_smithy_contents.rb +9 -0
  130. data/db/migrate/20121105222537_create_smithy_assets.rb +16 -0
  131. data/db/migrate/20121115215053_create_smithy_images.rb +15 -0
  132. data/db/migrate/20121127205022_add_external_link_to_smithy_pages.rb +5 -0
  133. data/db/migrate/20130115190505_add_markdown_content_to_smithy_contents.rb +5 -0
  134. data/db/migrate/20130123170918_set_defaults_for_show_in_navigation_and_cache_length.rb +6 -0
  135. data/db/migrate/20130311203806_create_smithy_page_lists.rb +15 -0
  136. data/db/migrate/20130312161116_remove_description_from_content_block.rb +5 -0
  137. data/db/migrate/20130326191051_add_html_attributes_to_images.rb +5 -0
  138. data/db/migrate/20131003210228_add_publishable_to_smithy_page_contents.rb +11 -0
  139. data/db/migrate/20131220160755_add_content_to_images.rb +5 -0
  140. data/db/migrate/20131223145710_add_position_to_smithy_template_containers.rb +5 -0
  141. data/lib/smithy/content_blocks/model.rb +16 -0
  142. data/lib/smithy/content_blocks/registry.rb +30 -0
  143. data/lib/smithy/content_blocks.rb +2 -0
  144. data/lib/smithy/content_pieces/base.rb +10 -0
  145. data/lib/smithy/content_pieces/registry.rb +39 -0
  146. data/lib/smithy/dependencies.rb +19 -0
  147. data/lib/smithy/dragonfly/asset_helper.rb +67 -0
  148. data/lib/smithy/dragonfly/remote_data_store.rb +33 -0
  149. data/lib/smithy/dragonfly.rb +30 -0
  150. data/lib/smithy/engine.rb +48 -0
  151. data/lib/smithy/formatter.rb +46 -0
  152. data/lib/smithy/liquid/database.rb +12 -0
  153. data/lib/smithy/liquid/drops/base.rb +16 -0
  154. data/lib/smithy/liquid/drops/page.rb +78 -0
  155. data/lib/smithy/liquid/filters/asset_tag.rb +33 -0
  156. data/lib/smithy/liquid/filters/resize.rb +12 -0
  157. data/lib/smithy/liquid/rendering.rb +50 -0
  158. data/lib/smithy/liquid/tags/asset.rb +54 -0
  159. data/lib/smithy/liquid/tags/csrf.rb +30 -0
  160. data/lib/smithy/liquid/tags/html.rb +61 -0
  161. data/lib/smithy/liquid/tags/nav.rb +76 -0
  162. data/lib/smithy/liquid.rb +8 -0
  163. data/lib/smithy/logger.rb +12 -0
  164. data/lib/smithy/version.rb +3 -0
  165. data/lib/smithy.rb +21 -0
  166. data/lib/smithycms.rb +1 -0
  167. data/lib/tasks/smithy_tasks.rake +4 -0
  168. data/lib/templates/erb/scaffold/_form.html.erb +11 -0
  169. metadata +871 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012-2013 Tim Glen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # Smithy CMS
2
+
3
+ [![Code Climate](https://codeclimate.com/github/sterrym/smithy.png)](https://codeclimate.com/github/sterrym/smithy)
4
+
5
+ ## Templates & Includes
6
+ These are the building blocks of a page. All the markup is written using the Liquid templating engine. This allows anyone to be able to write templates without the dangers of exposing the whole stack to the template editor.
7
+
8
+ ## Pages
9
+ On top of its own innate elements (title, permalink, etc), each page belongs to a template and through the template, has a set of available content containers. To each container, pieces of content can be added and organized via various "Content Blocks".
10
+
11
+ ## Content Blocks
12
+ A "Content Block" is simply an ActiveRecord model with a Smithy inclusion (<code>include Smithy::ContentBlocks::Model</code>), a <code>_form_fields</code> partial (preferably utilizing formtastic) and it's own set of templates, managed within Smithy.
13
+
14
+ ## Getting Started
15
+ To get started, add this to your Gemfile
16
+
17
+ ```ruby
18
+ gem 'smithy', :github => 'sterrym/smithy'
19
+ ```
20
+
21
+ If you need basic authentication and don't want to integrate with existing auth in your system, add this to your Gemfile too:
22
+ gem 'smithy-auth', :github => 'sterrym/smithy-auth'
23
+
24
+ Installing the CMS is simple, you can just
25
+
26
+ ```shell
27
+ bundle install
28
+ rake smithy:install:migrations
29
+ rake smithy_auth:install:migrations # (if you are using smithy-auth)
30
+ rake db:migrate
31
+ ```
32
+
33
+ To your routes file, you need to mount Smithy - typically, this would be done at the root
34
+
35
+ ```ruby
36
+ mount Smithy::Engine => "/"
37
+ ```
38
+
39
+ Now start up your server and go to http://localhost:nnnn/smithy
40
+
41
+ ## Integrating with third-party authentication
42
+
43
+ Add this to your routes file (below the `mount Smithy::Engine` line). It will redirect smithy/login|logout (the built-in paths) to your existing authentication paths.
44
+
45
+ ```ruby
46
+ scope "/smithy" do
47
+ match "/login" => redirect("/your/login/path"), :as => :login
48
+ match '/logout' => redirect("/"), :as => :logout
49
+ end
50
+ ```
51
+
52
+ Add the following to your application controller:
53
+
54
+ ```ruby
55
+ def smithy_current_user
56
+ current_user # use whichever method name you have implemented to return the current_user
57
+ end
58
+ helper_method :smithy_current_user
59
+ ```
60
+
61
+ If you wish for all of your users to have access to smithy, simply add this method to your user model:
62
+
63
+ ```ruby
64
+ def smithy_admin?
65
+ true
66
+ end
67
+ ```
68
+
69
+ Alternatively, you can add a boolean field (via migration) named `smithy_admin` to your users table and manage the field with with your existing user management.
70
+
71
+ Restart your local server and you should be good to go.
72
+
73
+ ### Templates
74
+
75
+ Create your first Template, naming it whatever you want ("Home" or "Default" or something equally original). In the content, add `{{ page.container.main_content }}`. In the background, this will auto-create a container that will be used by any page using your template. You can name your container whatever you would like: `{{ page.container.foo }}` works as well. After you have created new page containers, they will automatically show up on the Page edit screen and allow you to add content to the container.
76
+
77
+ If you want, you can create Includes. For instance, if you create an Include named "header", you can utilize it in your Template via `{% include 'header' %}`.
78
+
79
+ Note, you can also create stylesheet and javascript files, included in your templates via smithy_stylesheet_link_tag and smithy_javascript_include_tag. javascript_include_tag calls out directly to ActionView so you can also access files from your host application directly. Eg. `{% smithy_javascript_include_tag 'my_special_javascript' %}`
80
+
81
+ ### Pages
82
+
83
+ Follow the "Manage Content" link in the header and create your first page. Add a Title ("Home" for instance), select your Template and save the page. The page will save and you will be on the Edit screen for your new page. You can see that your "Main Content" container is now available.
84
+
85
+ ### Content Blocks
86
+
87
+ Smithy comes with some useful Content Blocks already created, though you may need to add them to your system: Content, Image, PageList. After adding a Content Block, you must also create at least one template for it before you can use it on a page. Once you have added a template, you can utilize that Content Block in any available Page container.
88
+
89
+ ### Adding Custom Content Blocks
90
+
91
+ While Smithy has some default Content Blocks, you will often want to add your own structured content, allowing you to manage templates for more structured content. To add a custom Content Block, do the following:
92
+
93
+ 1. create a new table & model or use an existing one from your app. This can be a single, stand-alone model or a model with associations, Smithy doesn't really care.
94
+ 2. Add `include Smithy::ContentBlocks::Model` to the top of your model. This gives some extra functionality for Smithy.
95
+ 2. Add a views/mymodel/_form_fields.html.erb to your app, replacing "mymodel" with your new model name. This is identical to adding your own view/partial for the model. An "f" variable is passed to the partial, which represents a formtastic form. While formtastic is outside the scope of this document (look it up!), you can also just create your form however you want though it will be way simpler to just use formtastic syntax!
96
+ 3. Smithy will automatically look for your _form_fields.html.erb partial to manage the Content Block when adding Page Content to a page.
97
+ 4. Register your Content Block by entering the Smithy admin, clicking on Content Blocks and adding a new Content Block with your new model name, creating a template for your new Content Block at the same time.
98
+
99
+ Your _form_fields.html.erb file could look something like this:
100
+
101
+ ```ruby
102
+ <%= f.inputs "Client Story" do %>
103
+ <%= f.input :client_name %>
104
+ <%= f.input :project_name %>
105
+ <%= f.input :content, :as => :text, :input_html => { :class => "span12" } %>
106
+ <% end %>
107
+ ```
108
+
109
+ If you want to customize which columns are available to your liquid template, you can add a #to_liquid method to your model. Eg.:
110
+
111
+ ```ruby
112
+ def to_liquid
113
+ {
114
+ 'id' => self.id,
115
+ 'client_name' => self.client_name,
116
+ 'project_name' => self.project_name,
117
+ 'content' => self.content,
118
+ 'story_images' => self.images.map(&:to_liquid),
119
+ 'formatted_content' => self.formatted_content
120
+ }
121
+ end
122
+ ```
123
+ Using the above #to_liquid method, your template could look like this:
124
+
125
+ ```html
126
+ <article class="client_story" id="client_story-{{ id }}">
127
+ <div class="content">
128
+ <h3>{{ client_name }}</h3>
129
+ {% unless project_name == blank %}<h4>{{ project_name }}</h4>{% endunless %}
130
+ {{ formatted_content }}
131
+ </div>
132
+ <div class="images">
133
+ <div class="cycle-slideshow">
134
+ {% for story_image in story_images %}
135
+ <img src="{{ story_image.thumbnail.url }}" alt="">
136
+ {% endfor %}
137
+ </div>
138
+ </div>
139
+ </article>
140
+ ```
141
+
142
+ If you want to be able to represent your ContentBlock uniquely in different contexts, you can simply create more templates and choose which template to use in each context.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Smithy'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
Binary file
Binary file
@@ -0,0 +1,13 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require 'smithy/jquery-ui.min'
4
+ //= require jquery-fileupload/basic
5
+ //= require jquery-fileupload/vendor/tmpl
6
+ //= require bootstrap
7
+ //= require ace/ace
8
+ //= require ace/mode-css.js
9
+ //= require ace/mode-html.js
10
+ //= require ace/mode-javascript.js
11
+ //= require ace/mode-liquid.js
12
+ //= require ace/mode-markdown.js
13
+ //= require_tree .
@@ -0,0 +1,35 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4
+ jQuery ->
5
+ $('#fileupload').fileupload
6
+ add: (e, data) ->
7
+ types = /(\.|\/)(gif|jpe?g|png|pdf)$/i
8
+ file = data.files[0]
9
+ if types.test(file.type) || types.test(file.name)
10
+ data.context = $(tmpl("template-upload", file))
11
+ $('#fileupload').append(data.context)
12
+ data.submit()
13
+ else
14
+ alert("#{file.name} is not a gif, jpeg, png or pdf file")
15
+
16
+ progress: (e, data) ->
17
+ if data.context
18
+ progress = parseInt(data.loaded / data.total * 100, 10)
19
+ data.context.find('.bar').css('width', progress + '%')
20
+
21
+ done: (e, data) ->
22
+ file = data.files[0]
23
+ domain = $('#fileupload').attr('action')
24
+ path = $('#fileupload input[name=key]').val().replace('${filename}', file.name)
25
+ to = $('#fileupload').data('post') + ".js"
26
+ content = {}
27
+ content[$('#fileupload').data('as')] = domain + path
28
+ $.post(to, content)
29
+
30
+ data.context.remove() if data.context # remove progress bar
31
+
32
+ fail: (e, data) ->
33
+ alert("#{data.files[0].name} failed to upload.")
34
+ console.log("Upload failed:")
35
+ console.log(data)
@@ -0,0 +1,23 @@
1
+ $('[data-toggle="remote-load"]').click(function(e) {
2
+ e.preventDefault();
3
+ var activator = this;
4
+ var remote = $(this).attr("href");
5
+ var target = $(this).attr("data-target");
6
+ if ($(target).filter(":empty").length > 0) {
7
+ $(target).hide();
8
+ $.ajax($(this).attr("href"), {
9
+ success: function(data) {
10
+ $(target).append($('<div data-type="remote-load"></div>').append(data));
11
+ $('[data-dismiss="remote-load"]', $(target)).on('click', function(e) {
12
+ e.preventDefault();
13
+ $(activator).click();
14
+ });
15
+ $(target).slideDown('slow');
16
+ }
17
+ });
18
+ } else if ($(target).filter(":hidden").length > 0) {
19
+ $(target).slideDown('slow');
20
+ } else if ($(target).filter(":visible").length > 0) {
21
+ $(target).slideUp('slow');
22
+ }
23
+ });