common-interface 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/Rakefile +66 -0
  2. data/lib/common_interface.rb +39 -0
  3. data/lib/common_interface/README.md +51 -0
  4. data/lib/common_interface/demo/basic.rb +96 -0
  5. data/lib/common_interface/demo/site.rb +10 -0
  6. data/lib/common_interface/demo/view_helper.rb +17 -0
  7. data/lib/common_interface/public/common_interface/asset_packages.yml +89 -0
  8. data/lib/common_interface/public/common_interface/images/img1.jpg +0 -0
  9. data/lib/common_interface/public/common_interface/images/img1_200.jpg +0 -0
  10. data/lib/common_interface/public/common_interface/images/img1_icon.jpg +0 -0
  11. data/lib/common_interface/public/common_interface/images/img1_thumb.jpg +0 -0
  12. data/lib/common_interface/public/common_interface/images/img2.jpg +0 -0
  13. data/lib/common_interface/public/common_interface/images/img2_200.jpg +0 -0
  14. data/lib/common_interface/public/common_interface/images/img2_icon.jpg +0 -0
  15. data/lib/common_interface/public/common_interface/images/img2_thumb.jpg +0 -0
  16. data/lib/common_interface/public/common_interface/images/img3.jpg +0 -0
  17. data/lib/common_interface/public/common_interface/images/img3_200.jpg +0 -0
  18. data/lib/common_interface/public/common_interface/images/img3_icon.jpg +0 -0
  19. data/lib/common_interface/public/common_interface/images/img3_thumb.jpg +0 -0
  20. data/lib/common_interface/public/common_interface/images/video_icon.png +0 -0
  21. data/lib/common_interface/public/common_interface/js/aspects.js +0 -0
  22. data/lib/common_interface/public/common_interface/js/basic.js +229 -0
  23. data/lib/common_interface/public/common_interface/js/files_upload.js +115 -0
  24. data/lib/common_interface/public/common_interface/js/items.js +118 -0
  25. data/lib/common_interface/public/common_interface/js/style.js +50 -0
  26. data/lib/common_interface/public/common_interface/lib/jquery.elastic.js +117 -0
  27. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/blank.gif +0 -0
  28. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_close.png +0 -0
  29. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_loading.png +0 -0
  30. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_nav_left.png +0 -0
  31. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_nav_right.png +0 -0
  32. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_e.png +0 -0
  33. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_n.png +0 -0
  34. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_ne.png +0 -0
  35. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_nw.png +0 -0
  36. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_s.png +0 -0
  37. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_se.png +0 -0
  38. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_sw.png +0 -0
  39. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_shadow_w.png +0 -0
  40. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_left.png +0 -0
  41. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_main.png +0 -0
  42. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_over.png +0 -0
  43. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancy_title_right.png +0 -0
  44. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancybox-x.png +0 -0
  45. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancybox-y.png +0 -0
  46. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/fancybox.png +0 -0
  47. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.easing-1.3.pack.js +72 -0
  48. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.fancybox-1.3.1.js +1077 -0
  49. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.fancybox.css +363 -0
  50. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.fancybox.js +44 -0
  51. data/lib/common_interface/public/common_interface/lib/jquery.fancybox/jquery.mousewheel-3.0.2.pack.js +13 -0
  52. data/lib/common_interface/public/common_interface/lib/jquery.form.js +660 -0
  53. data/lib/common_interface/public/common_interface/lib/jquery.hoverIntent.js +111 -0
  54. data/lib/common_interface/public/common_interface/lib/jquery.jgrowl/jquery.jgrowl.css +128 -0
  55. data/lib/common_interface/public/common_interface/lib/jquery.jgrowl/jquery.jgrowl.js +307 -0
  56. data/lib/common_interface/public/common_interface/lib/jquery.js +4376 -0
  57. data/lib/common_interface/public/common_interface/lib/jquery.json.js +178 -0
  58. data/lib/common_interface/public/common_interface/lib/jquery.swfupload/cancel.png +0 -0
  59. data/lib/common_interface/public/common_interface/lib/jquery.swfupload/jquery.swfupload.js +64 -0
  60. data/lib/common_interface/public/common_interface/lib/jquery.swfupload/style.css +8 -0
  61. data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/swfupload.js +980 -0
  62. data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/swfupload.queue.js +98 -0
  63. data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/swfupload.swf +0 -0
  64. data/lib/common_interface/public/common_interface/lib/jquery.swfupload/swfupload/wdp_buttons_upload_61x22.png +0 -0
  65. data/lib/common_interface/public/common_interface/lib/jquery.template.js +255 -0
  66. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  67. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  68. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_flat_10_000000_40x100.png +0 -0
  69. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  70. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  71. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  72. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  73. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  74. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  75. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_222222_256x240.png +0 -0
  76. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_228ef1_256x240.png +0 -0
  77. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_ef8c08_256x240.png +0 -0
  78. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_ffd27a_256x240.png +0 -0
  79. data/lib/common_interface/public/common_interface/lib/jquery.ui/images/ui-icons_ffffff_256x240.png +0 -0
  80. data/lib/common_interface/public/common_interface/lib/jquery.ui/jquery.ui.css +406 -0
  81. data/lib/common_interface/public/common_interface/lib/jquery.ui/jquery.ui.js +71 -0
  82. data/lib/common_interface/public/common_interface/themes/default/_aspects.scss +58 -0
  83. data/lib/common_interface/public/common_interface/themes/default/_basic.scss +228 -0
  84. data/lib/common_interface/public/common_interface/themes/default/_components.scss +151 -0
  85. data/lib/common_interface/public/common_interface/themes/default/_custom_reset.scss +12 -0
  86. data/lib/common_interface/public/common_interface/themes/default/_elastic.scss +72 -0
  87. data/lib/common_interface/public/common_interface/themes/default/_items.scss +88 -0
  88. data/lib/common_interface/public/common_interface/themes/default/_mixins.scss +39 -0
  89. data/lib/common_interface/public/common_interface/themes/default/_special.scss +34 -0
  90. data/lib/common_interface/public/common_interface/themes/default/_variables.scss +15 -0
  91. data/lib/common_interface/public/common_interface/themes/default/_yui_reset.scss +127 -0
  92. data/lib/common_interface/public/common_interface/themes/default/elastic.js +307 -0
  93. data/lib/common_interface/public/common_interface/themes/default/elastic.print.css +8 -0
  94. data/lib/common_interface/public/common_interface/themes/default/reset.css +157 -0
  95. data/lib/common_interface/public/common_interface/themes/default/reset.scss +5 -0
  96. data/lib/common_interface/public/common_interface/themes/default/style.css +580 -0
  97. data/lib/common_interface/public/common_interface/themes/default/style.js +84 -0
  98. data/lib/common_interface/public/common_interface/themes/default/style.scss +11 -0
  99. data/lib/common_interface/public/common_interface/themes/simple_organization/_fixes.scss +130 -0
  100. data/lib/common_interface/public/common_interface/themes/simple_organization/_original.scss +852 -0
  101. data/lib/common_interface/public/common_interface/themes/simple_organization/img/comment-arrow.gif +0 -0
  102. data/lib/common_interface/public/common_interface/themes/simple_organization/img/comment-gravatar.gif +0 -0
  103. data/lib/common_interface/public/common_interface/themes/simple_organization/img/comment-reply.gif +0 -0
  104. data/lib/common_interface/public/common_interface/themes/simple_organization/img/logo-small.gif +0 -0
  105. data/lib/common_interface/public/common_interface/themes/simple_organization/img/logo.gif +0 -0
  106. data/lib/common_interface/public/common_interface/themes/simple_organization/img/main-two-columns-left.gif +0 -0
  107. data/lib/common_interface/public/common_interface/themes/simple_organization/img/main-two-columns.gif +0 -0
  108. data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-event.jpg +0 -0
  109. data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-gravatar.gif +0 -0
  110. data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-image.jpg +0 -0
  111. data/lib/common_interface/public/common_interface/themes/simple_organization/img/sample-thumbnail.jpg +0 -0
  112. data/lib/common_interface/public/common_interface/themes/simple_organization/original/archives.html +389 -0
  113. data/lib/common_interface/public/common_interface/themes/simple_organization/original/comments.html +486 -0
  114. data/lib/common_interface/public/common_interface/themes/simple_organization/original/empty-page.html +107 -0
  115. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/comment-arrow.gif +0 -0
  116. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/comment-gravatar.gif +0 -0
  117. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/comment-reply.gif +0 -0
  118. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/logo-small.gif +0 -0
  119. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/logo.gif +0 -0
  120. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/main-two-columns-left.gif +0 -0
  121. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/main-two-columns.gif +0 -0
  122. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-event.jpg +0 -0
  123. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-gravatar.gif +0 -0
  124. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-image.jpg +0 -0
  125. data/lib/common_interface/public/common_interface/themes/simple_organization/original/img/sample-thumbnail.jpg +0 -0
  126. data/lib/common_interface/public/common_interface/themes/simple_organization/original/index.html +307 -0
  127. data/lib/common_interface/public/common_interface/themes/simple_organization/original/left-sidebar.html +307 -0
  128. data/lib/common_interface/public/common_interface/themes/simple_organization/original/no-subnavigation.html +290 -0
  129. data/lib/common_interface/public/common_interface/themes/simple_organization/original/single-column.html +209 -0
  130. data/lib/common_interface/public/common_interface/themes/simple_organization/original/style-demo.html +355 -0
  131. data/lib/common_interface/public/common_interface/themes/simple_organization/original/style.css +658 -0
  132. data/lib/common_interface/public/common_interface/themes/simple_organization/style.css +965 -0
  133. data/lib/common_interface/public/common_interface/themes/simple_organization/style.scss +2 -0
  134. data/lib/common_interface/public/common_interface/themes/simple_organization/tmp/comments.html +486 -0
  135. data/lib/common_interface/public/common_interface/themes/simple_organization/tmp/tmp.html +307 -0
  136. data/lib/common_interface/tmp/html.html +39 -0
  137. data/lib/common_interface/tmp/js.js +78 -0
  138. data/lib/common_interface/view_helper.rb +52 -0
  139. data/readme.md +49 -0
  140. data/spec/basic_spec.rb +63 -0
  141. data/spec/helper.rb +8 -0
  142. data/spec/spec.opts +4 -0
  143. metadata +221 -0
data/Rakefile ADDED
@@ -0,0 +1,66 @@
1
+ require 'rake'
2
+ require 'spec/rake/spectask'
3
+
4
+ Dir.chdir File.dirname(__FILE__)
5
+
6
+ # Specs
7
+ task :default => :spec
8
+
9
+ Spec::Rake::SpecTask.new('spec') do |t|
10
+ t.spec_files = FileList["spec/**/*_spec.rb"].select{|f| f !~ /\/_/}
11
+ t.libs = ['lib'].collect{|f| "#{File.dirname __FILE__}/#{f}"}
12
+ end
13
+
14
+ # Gem
15
+ require 'rake/clean'
16
+ require 'rake/gempackagetask'
17
+ require 'fileutils'
18
+
19
+ spec = Gem::Specification.new do |s|
20
+ s.name = "common-interface"
21
+ s.version = "0.0.3"
22
+ s.summary = "Rapid Web Interface Creation for the Crystal framework"
23
+ s.description = "Rapid Web Interface Creation for the Crystal framework"
24
+ s.author = "Alexey Petrushin"
25
+ # s.email = ""
26
+ s.homepage = "http://github.com/alexeypetrushin/common-interface"
27
+
28
+ s.platform = Gem::Platform::RUBY
29
+ s.has_rdoc = true
30
+ # s.extra_rdoc_files = ["README.rdoc"]
31
+
32
+ # s.files = (%w{rakefile readme.md .gitignore} + Dir.glob("{app,lib,spec,.git}/**/*"))
33
+ s.files = (['Rakefile', 'readme.md'] + Dir.glob("{lib,spec}/**/*"))
34
+
35
+ s.require_paths = ["lib"]
36
+
37
+ [
38
+ 'abstract-interface',
39
+ ].each{|name| s.add_dependency(name)}
40
+
41
+ end
42
+
43
+ PACKAGE_DIR = "#{File.expand_path File.dirname(__FILE__)}/build"
44
+
45
+ Rake::GemPackageTask.new(spec) do |p|
46
+ package_dir = PACKAGE_DIR
47
+ # FileUtils.mkdir package_dir unless File.exist? package_dir
48
+ p.need_tar = true if RUBY_PLATFORM !~ /mswin/
49
+ p.need_zip = true
50
+ p.package_dir = package_dir
51
+ end
52
+
53
+ # CLEAN.include [ 'pkg', '*.gem']
54
+
55
+ task :push do
56
+ dir = Dir.chdir PACKAGE_DIR do
57
+ gem_file = Dir.glob("common-interface*.gem").first
58
+ system "gem push #{gem_file}"
59
+ end
60
+ end
61
+
62
+ task :clean do
63
+ system "rm -r #{PACKAGE_DIR}"
64
+ end
65
+
66
+ task :release => [:gem, :push, :clean]
@@ -0,0 +1,39 @@
1
+ require 'abstract_interface'
2
+ require 'crystal_jquery'
3
+
4
+ dir = File.dirname(__FILE__)
5
+
6
+ # Settings
7
+ AbstractInterface.plugin_name = 'common_interface'
8
+
9
+ AbstractInterface.generate_helper_methods \
10
+ :aspects => %w{discussion comment controls details paginator tag_selector},
11
+ :basic => %w{bottom_panel dialog divider inplace message more narrow navigation navigation_item popup text title top_panel tool},
12
+ :components => %w{basic_list basic_list_item table table_row tabs tabs_item toolbar},
13
+ :items => %w{folder list list_item note page user thumb line file selector}
14
+
15
+ AbstractInterface.available_themes.push *%w{default simple_organization}
16
+ AbstractInterface.layout_configurations_dir = "/#{Crystal::Template::DIRECTORY_NAME}/layouts/config"
17
+
18
+ # Helpers
19
+ require 'common_interface/view_helper'
20
+ Crystal::ControllerContext.include CommonInterface::ViewHelper
21
+
22
+ # Initializers
23
+ crystal.after :environment do
24
+ crystal.ensure_public_symlink "common_interface", "#{dir}/common_interface/public/common_interface"
25
+ end
26
+
27
+ # Assets and public folder
28
+ require 'asset_packager'
29
+ AssetPackager.add "#{dir}/common_interface/public/common_interface/asset_packages.yml", "#{dir}/common_interface/public"
30
+
31
+
32
+ # Demo
33
+ module CommonInterface
34
+ module Demo
35
+ autoload :ViewHelper, 'common_interface/demo/view_helper'
36
+ autoload :Basic, 'common_interface/demo/basic'
37
+ autoload :Site, 'common_interface/demo/site'
38
+ end
39
+ end
@@ -0,0 +1,51 @@
1
+ # Common Interface
2
+ Common Interface is a tool for **Rapid Web Interface Creation**, Ruby on Rails Plugin (more exactly, it's the concrete implementation of the [Abstract Inteface][abstract-interface] plugin).
3
+
4
+ Instead of trying to provide one universal user interface API (like GWT) to fit all needs, the [Abstract Interface][abstract-interface] **provides you with tools that ease creation of your own custom interface**.
5
+
6
+ Define Your design only one time, in one place, and then reuse it, forget about HTML and CSS in your Views.
7
+
8
+ It acts like an abstraction layer, allowing you to define your custom API (or DSL if you like) to build your user interface. Key point here - it allows you build such API **very quick and easy**.
9
+
10
+ # Demo
11
+
12
+ * [Sample of HomePage][sample1], [sample of page (with another design)][sample2]
13
+ * [List of all Samples][list_of_samples]
14
+
15
+ Real-life sample - [http://bos-tec.com](http://bos-tec.com), [http://bom4.com](http://bom4.com), there's no any custom template, all pages are made with the [Abstract Interface][abstract-interface] plugin.
16
+
17
+ # Advantages
18
+
19
+ * **Themes support** not only CSS, you can use completelly different HTML and layouts
20
+ * **DRY**
21
+ * **Clean views**
22
+ * **Iterative development**
23
+ * **Loose coupling of Logic and Design**
24
+ * **Share the same design with many Apps**
25
+ * **Mix two complete different themes** simultaneously, in the same page
26
+ * Start with simple prototype and when App matures create professional design (with minimum changes in App)
27
+ * Theme/Skin support (not only CSS but also Templates, Images, ...)
28
+ * Outsource design without opening App code
29
+ * Designers can go ahead and create working html/css/js
30
+ * Programmers can go ahead and create working App with simple design
31
+ * Both of them can do iterative prototyping that will be updated later
32
+
33
+ # Usage
34
+
35
+ 1. sudo gem install rails-ext
36
+ 2. install this plugin in your rails App
37
+ 3. create symlink (in linux) or copy <plugin>/public/themes/ directory to <your_rails_App>/public
38
+ 4. start your rails App and go to /theme
39
+
40
+
41
+ **Notice!** Common Interface is the interface that I build for my own need (you can also use it, by the way).
42
+ But to create you own design you need to create your own 'Common Interface', using this code as a sample.
43
+
44
+
45
+ Copyright (c) 2009 Alexey Petrushin [http://bos-tec.com](http://www.bos-tec.com), released under the MIT license.
46
+
47
+ [abstract-interface]: http://github.com/alexeypetrushin/rails-ext
48
+
49
+ [sample1]: http://bos-tec.com/theme_site/home?_layout_template=home&_theme=simple_organization
50
+ [sample2]: http://bos-tec.com/theme/page
51
+ [list_of_samples]: http://bos-tec.com/theme/index
@@ -0,0 +1,96 @@
1
+ module CommonInterface
2
+ module Demo
3
+ class Basic
4
+ inherit Crystal::HttpController
5
+ helper CommonInterface::Demo::ViewHelper
6
+
7
+ before :prepare_samples, :prepare_theme
8
+
9
+ layout '/CommonInterface/Demo/layouts/theme', :except => %w(help index)
10
+
11
+ def help; end
12
+ def dialog; end
13
+ def index; end
14
+ def aspects; end
15
+ def basic; end
16
+ def basic2; end
17
+ def folder; end
18
+ def items; end
19
+ def list; end
20
+ def page; end
21
+ def selector; end
22
+ def user; end
23
+ def style; end
24
+ def popup; end
25
+ def tmp; end
26
+
27
+ def select_menu
28
+ session[:top_menu] = params[:top_menu] if params[:top_menu]
29
+ session[:side_menu] = params[:side_menu] if params[:side_menu]
30
+
31
+ redirect_to :back
32
+ end
33
+
34
+ attr_reader :samples
35
+
36
+ def title
37
+ workspace.method_name.humanize
38
+ end
39
+ helper_method :title
40
+
41
+ protected
42
+ def prepare_theme
43
+ current_theme.name = params[:_theme]
44
+ current_theme.layout_template = params[:_layout_template]
45
+ end
46
+
47
+ def prepare_samples
48
+ @samples = {
49
+ :title => workspace.method_name.humanize,
50
+
51
+ :top_menu_items => %w(Email Contacts Calendar Files),
52
+ :active_top_menu => (workspace.request.session[:top_menu] || 'Email'),
53
+
54
+ :side_menu_items => %w(control_caption_0 control_caption_1 control_caption_2),
55
+ :active_side_menu => (workspace.request.session[:side_menu] || 'control_caption_0'),
56
+
57
+ :tabs => %w(Compose Contacts Import Categories),
58
+ :active_tab => 'Compose',
59
+
60
+ :common_name => "Terminator Movie Series",
61
+ :common_tags => ['egypt', 'photo', 'travel'].collect{|w| "<a href='#'>#{w}</a>"},
62
+ :common_details => ["Today at 15:58", "by <a href='#'>admin</a>", "{7}"],
63
+ :comment_details => ["Today at 15:58", "by <a href='#'>admin</a>"],
64
+ :common_controls => %w{add edit delete}.collect{|w| "<a href='#'>#{w}</a>"},
65
+
66
+ :model => {
67
+ :name => "Some Name",
68
+ :active => true,
69
+ :body => "Some text",
70
+ :errors => {
71
+ :base => ["Base Error Description", "Base Error Description 2"],
72
+ :name => ["Name Error Description 1", "Name Error Description 2"]
73
+ }
74
+ },
75
+
76
+ :detail_text => %(
77
+ <p>The Terminator (1984) <a href='#'>More at IMDbPro</a></p>
78
+ <p>Your future is in his hands.</p>
79
+ ),
80
+
81
+ :note_text => %(
82
+ <p>The Terminator (1984) <a href='#'>More at IMDbPro</a></p>
83
+ <p>In the Year of Darkness, 2029, the rulers of this planet devised the ultimate plan. They would reshape the Future by changing the Past. The plan required something that felt no pity. No pain. No fear. Something unstoppable. They created 'THE TERMINATOR'</p>
84
+ <p>The thing that won't die, in the nightmare that won't end. A human-looking, apparently unstoppable cyborg is sent from the future to kill Sarah Connor; Kyle Reese is sent to stop it.</p>
85
+ <p>Your future is in his hands.</p>
86
+ ),
87
+
88
+ :comment_text => %(
89
+ <p>Although the Stack Overflow engine was always designed with a technical audience in mind, I’m intrigued to see how far we can push the boundaries of that audience.</p>
90
+ <p>We’ve pushed a little bit when going from programmers, to sysadmins, to power computer users — and we may try pushing a tad further this year with yet another site.</p>
91
+ )
92
+ }.to_openobject
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,10 @@
1
+ module CommonInterface
2
+ module Demo
3
+ class Site < Basic
4
+ def blog; end
5
+ def home; end
6
+ def post; end
7
+ def style; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ module CommonInterface
2
+ module Demo
3
+ module ViewHelper
4
+ def samples
5
+ @samples
6
+ end
7
+
8
+ def t key, options = {}
9
+ key.to_s
10
+ end
11
+
12
+ def metadata
13
+ current_theme.metadata
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,89 @@
1
+ ---
2
+ javascripts:
3
+ common_interface_base:
4
+ # Core
5
+ - common_interface/lib/jquery.js
6
+ - common_interface/lib/jquery.json.js
7
+ - common_interface/lib/jquery.hoverIntent.js
8
+ - common_interface/lib/jquery.template.js
9
+ - common_interface/lib/jquery.jgrowl/jquery.jgrowl.js
10
+ - common_interface/lib/jquery.form.js
11
+
12
+ - /crystal_jquery/jquery.crystal.js
13
+
14
+ - common_interface/js/basic.js
15
+ - common_interface/js/items.js
16
+ - common_interface/js/aspects.js
17
+ - common_interface/js/style.js
18
+
19
+ #
20
+ # Files Upload, TODO3 (load it dynamically)
21
+ # using $.getScript("/some_script.js");
22
+ # - files_upload:
23
+ - common_interface/lib/jquery.swfupload/swfupload/swfupload.js
24
+ - common_interface/lib/jquery.swfupload/swfupload/swfupload.queue.js
25
+ - common_interface/lib/jquery.swfupload/jquery.swfupload.js
26
+ - common_interface/js/files_upload.js
27
+
28
+ # Images, Slides
29
+ - common_interface/lib/jquery.fancybox/jquery.fancybox.js
30
+
31
+ # Interactions
32
+ - common_interface/lib/jquery.ui/jquery.ui.js
33
+
34
+ # Elastic TextArea
35
+ - common_interface/lib/jquery.elastic.js
36
+
37
+ # Default theme
38
+ - common_interface/themes/default/elastic.js
39
+ - common_interface/themes/default/style.js
40
+
41
+
42
+ stylesheets:
43
+ common_interface_base:
44
+ # CSS Reset
45
+ - common_interface/themes/default/reset.css
46
+
47
+ # Default theme
48
+ - common_interface/themes/default/style.css
49
+
50
+ # Core
51
+ - common_interface/lib/jquery.jgrowl/jquery.jgrowl.css
52
+
53
+ - /crystal_jquery/jquery.crystal.css
54
+
55
+ #
56
+ # Files Upload, TODO3 (load it dynamically)
57
+ # - files_upload:
58
+ - common_interface/lib/jquery.swfupload/style.css
59
+
60
+ # Images, Slides
61
+ - common_interface/lib/jquery.fancybox/jquery.fancybox.css
62
+
63
+ # Interactions
64
+ - common_interface/lib/jquery.ui/jquery.ui.css
65
+
66
+
67
+ #
68
+ # Mixin, for usage in incomplete themes, to support default theme partials.
69
+ # The same as common_interface_base but without global 'reset.css'
70
+ #
71
+ common_interface_base_mixin:
72
+ # Default theme
73
+ - common_interface/themes/default/style.css
74
+
75
+ # Core
76
+ - common_interface/lib/jquery.jgrowl/jquery.jgrowl.css
77
+
78
+ - /crystal_jquery/jquery.crystal.css
79
+
80
+ #
81
+ # Files Upload, TODO3 (load it dynamically)
82
+ # - files_upload:
83
+ - common_interface/lib/jquery.swfupload/style.css
84
+
85
+ # Images, Slides
86
+ - common_interface/lib/jquery.fancybox/jquery.fancybox.css
87
+
88
+ # Interactions
89
+ - common_interface/lib/jquery.ui/jquery.ui.css
@@ -0,0 +1,229 @@
1
+ // requirements
2
+ railsExt;
3
+
4
+ //
5
+ // More
6
+ //
7
+ $._opened_more_containers = {};
8
+ $.callOnceForEvery('more', '._more', function(){
9
+ var more = $(this);
10
+ var button = more.find('._button:first');
11
+ var content = more.find('._content:first');
12
+
13
+ // more button
14
+ button.click(function(){
15
+ $._opened_more_containers[more.attr('id')] = true;
16
+ more.replaceWith(content.contents());
17
+ $.processInitializers();
18
+ return false
19
+ });
20
+
21
+ // if opened once, keep it open in all next ajax updates
22
+ if($._opened_more_containers[more.attr('id')]){
23
+ more.replaceWith(content.contents());
24
+ $.processInitializers();
25
+ };
26
+ });
27
+
28
+ //
29
+ // Messages
30
+ //
31
+ $.jGrowl.defaults.position = 'bottom-right'
32
+ $.extend({
33
+ infoMessage: function(message){
34
+ this.jGrowl(message);
35
+ },
36
+
37
+ errorMessage: function(message){
38
+ this.jGrowl(message);
39
+ }
40
+ });
41
+
42
+
43
+ //
44
+ // Inplace Editor
45
+ //
46
+ $.callOnceForEvery('inplace', '._inplace', function() {
47
+ var inplace = $(this);
48
+ var id = inplace.dataAttr('original_id');
49
+ if(!id) warn("inplace original_id isn't defined!");
50
+
51
+ // Universal Cancel Button (for General and AJAX forms)
52
+ inplace.find('._redirect_back_or_close_dialog').click(function(){
53
+ inplace.remove();
54
+ $('#' + id).show();
55
+ $.processInitializers();
56
+ return false;
57
+ });
58
+
59
+ // Universal Submit Button (for General and AJAX forms)
60
+ inplace.find('._submit_form_or_ajax_form').click(function(){
61
+ var form = inplace.find('form');
62
+
63
+ var data = {
64
+ format: 'js',
65
+ target: $(this).identify(),
66
+ };
67
+
68
+ // Calculating index inside container (only if it's inside container)
69
+ if(!inplace.parents('._container').blank()){
70
+ var container = inplace.parents('._container').first();
71
+ var list = container.find('> ._item, #' + inplace.identify());
72
+ var index = list.index(inplace);
73
+ data['index'] = index;
74
+ }
75
+
76
+ form.ajaxSubmit({data: data, dataType: 'script'});
77
+
78
+ return false;
79
+ });
80
+ });
81
+
82
+ $.fn.extend({
83
+ add_inplace: function(container, html, add_method){
84
+ var target = $(this).parents('._inplace_target');
85
+ if(!target.blank()){
86
+ target.after(html);
87
+ }else{
88
+ // if($(container + ' ._inplace._new_inplace').blank()) {
89
+ // var inplace = $(html).addClass('_new_inplace');
90
+ var inplace = $(html);
91
+ var container = $(container);
92
+ add_method = add_method || 'append';
93
+ container[add_method](inplace);
94
+ // }
95
+ }
96
+ },
97
+
98
+ edit_inplace: function(id, html){
99
+ var inplace = $(html);
100
+ inplace.dataAttr('original_id', id);
101
+
102
+ var original = $('#' + id);
103
+ original.hide();
104
+
105
+ var previous_inplace = $(this).parents('._inplace');
106
+ if(!previous_inplace.blank()){
107
+ previous_inplace.replaceWith(inplace);
108
+ }else{
109
+ original.after(inplace);
110
+ }
111
+ },
112
+
113
+ update_inplace: function(id, html){
114
+ var original = $('#' + id);
115
+ original.remove();
116
+
117
+ var previous_inplace = $(this).parents('._inplace');
118
+ previous_inplace.replaceWith(html);
119
+ }
120
+ });
121
+
122
+
123
+ //
124
+ // Dialog
125
+ //
126
+ $.callOnceForEvery('dialog', '._dialog', function() {
127
+ // Universal Form Cancel Button (for General and AJAX forms)
128
+ var dialog = $(this);
129
+ dialog.find('._redirect_back_or_close_dialog').click(function(){
130
+ dialog.remove();
131
+ return false;
132
+ });
133
+
134
+ // Universal Submit Button (for General and AJAX forms)
135
+ dialog.find('._submit_form_or_ajax_form').click(function(){
136
+ dialog.hide();
137
+
138
+ var form = dialog.find('form');
139
+ form.ajaxSubmit({
140
+ data: {
141
+ format: 'js'
142
+ },
143
+ dataType: 'script',
144
+ success: function(){
145
+ dialog.remove(); // can be removed only when form is posted, othervise it doesn't works with files
146
+ }
147
+ });
148
+
149
+ return false;
150
+ });
151
+
152
+ // Center dialog
153
+ var winH = $(window).height();
154
+ var winW = $(window).width();
155
+ var scroll_top = $(window).scrollTop();
156
+ var layoutW = $('._layout_content').width();
157
+ dialog.css('top', winH/3 + scroll_top - dialog.height()/2);
158
+ dialog.css('left', layoutW/2 - dialog.width()/2);
159
+ // More about cool modal dialog: http://www.queness.com/post/77/simple-jquery-modal-window-tutorial
160
+ });
161
+
162
+ $.fn.extend({
163
+ showDialog: function(dialogHtml){
164
+ $('._dialog').remove();
165
+ $('._main').append(dialogHtml);
166
+
167
+ $.refresh_js_css();
168
+ }
169
+ });
170
+
171
+ //
172
+ // Popup
173
+ //
174
+ $.callOnceForEvery('popup', 'body', function() {
175
+ $(this).click(function(){
176
+ $('._active_popup').remove();
177
+ });
178
+ });
179
+
180
+ // Embedded popup (popup without AJAX)
181
+ $.callOnceForEvery('embedded_popup', '._embedded_popup', function() {
182
+ var e = $(this);
183
+ e.click(function(){
184
+ var content = $("#" + e.dataAttr('content_id'));
185
+ e.showPopup(content.html());
186
+ return false;
187
+ });
188
+ });
189
+
190
+ // showPopup
191
+ $.fn.extend({
192
+ showPopup: function(popupHtml){
193
+ if(popupHtml.blank()){
194
+ log("Content for PopUp is blank!");
195
+ return;
196
+ }
197
+
198
+ $('._active_popup').remove();
199
+ var popup = $(popupHtml)
200
+ popup.addClass('_active_popup');
201
+ $('._main').append(popup);
202
+
203
+ $.refresh_js_css();
204
+
205
+ // Positioning
206
+ var layout_content = $('._layout_content');
207
+
208
+ var left = $(this).offset().left + this.width() / 2;
209
+ var top = $(this).offset().top + this.height() / 2;
210
+
211
+ var border_bottom = $(window).scrollTop() + $(window).height();
212
+ var border_right = layout_content.width();
213
+ var left_pos, top_pos;
214
+ var offset = 5;
215
+ if(border_right - (offset * 2) >= left + popup.width()){
216
+ left_pos = left + offset;
217
+ }else{
218
+ left_pos = border_right - popup.width() - (offset * 3);
219
+ }
220
+
221
+ if(border_bottom + (offset * 2) >= top + popup.height()){
222
+ top_pos = top + offset;
223
+ }else{
224
+ top_pos = top - popup.height() - offset;
225
+ }
226
+
227
+ popup.css({left:left_pos, top:top_pos});
228
+ }
229
+ });