playmo 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/README.md +55 -0
  4. data/Rakefile +2 -0
  5. data/TODO.md +16 -0
  6. data/lib/app/helpers/playmo_helper.rb +54 -0
  7. data/lib/generators/playmo/USAGE +8 -0
  8. data/lib/generators/playmo/install_generator.rb +166 -0
  9. data/lib/generators/playmo/templates/application.html.erb +56 -0
  10. data/lib/generators/playmo/templates/application_controller.rb +9 -0
  11. data/lib/generators/playmo/templates/application_helper.rb +21 -0
  12. data/lib/generators/playmo/templates/assets.yml +32 -0
  13. data/lib/generators/playmo/templates/deploy.rb +50 -0
  14. data/lib/generators/playmo/templates/jquery/jquery-1.5.2.min.js +16 -0
  15. data/lib/generators/playmo/templates/jquery/rails.js +157 -0
  16. data/lib/generators/playmo/templates/mootools/mootools-core-1.3.1.js +485 -0
  17. data/lib/generators/playmo/templates/mootools/mootools-more-1.3.1.1.js +741 -0
  18. data/lib/generators/playmo/templates/mootools/rails.js +161 -0
  19. data/lib/generators/playmo/templates/tasks/assets.rake +10 -0
  20. data/lib/generators/playmo/templates/tasks/sass.rake +8 -0
  21. data/lib/playmo.rb +12 -0
  22. data/playmo.gemspec +22 -0
  23. data/stylesheets/_playmo_rails.sass +13 -0
  24. data/stylesheets/playmo-rails/_fonts.scss +46 -0
  25. data/stylesheets/playmo-rails/_handheld.scss +8 -0
  26. data/stylesheets/playmo-rails/_helpers.scss +57 -0
  27. data/stylesheets/playmo-rails/_media.scss +60 -0
  28. data/stylesheets/playmo-rails/_reset.scss +56 -0
  29. data/stylesheets/playmo-rails/_styles.scss +125 -0
  30. data/templates/project/boilerplate/css/handheld.scss +7 -0
  31. data/templates/project/boilerplate/css/style.scss +141 -0
  32. data/templates/project/boilerplate/files/apple-touch-icon.png +0 -0
  33. data/templates/project/boilerplate/files/crossdomain.xml +25 -0
  34. data/templates/project/boilerplate/files/favicon.ico +0 -0
  35. data/templates/project/boilerplate/files/robots.txt +5 -0
  36. data/templates/project/boilerplate/js/libs/dd_belatedpng.js +13 -0
  37. data/templates/project/boilerplate/js/libs/modernizr-1.7.min.js +2 -0
  38. data/templates/project/google/google.yml +22 -0
  39. data/templates/project/manifest.rb +34 -0
  40. data/templates/project/playmo/article.scss +69 -0
  41. data/templates/project/playmo/icons/outgoing.png +0 -0
  42. data/templates/project/playmo/playmo.scss +90 -0
  43. data/templates/project/rails/public/stylesheets/layout.scss +20 -0
  44. data/templates/project/rails/public/stylesheets/print.scss +11 -0
  45. data/templates/project/rails/public/stylesheets/screen.scss +14 -0
  46. data/templates/project/rails/public/stylesheets/wysiwyg.scss +19 -0
  47. metadata +112 -0
@@ -0,0 +1,161 @@
1
+ /*
2
+ ---
3
+ description: A MooTools driver for the Ruby on Rails 3 unobtrusive JavaScript API.
4
+
5
+ license: MIT-style
6
+
7
+ authors:
8
+ - Kevin Valdek
9
+
10
+ requires:
11
+ core/1.3: '*'
12
+
13
+ provides:
14
+ - Rails 3 MooTools driver
15
+
16
+ ...
17
+ */
18
+
19
+ window.addEvent('domready', function() {
20
+
21
+ rails.csrf = {
22
+ token: rails.getCsrf('token'),
23
+ param: rails.getCsrf('param')
24
+ };
25
+
26
+ rails.applyEvents();
27
+ });
28
+
29
+ (function($) {
30
+
31
+ window.rails = {
32
+ /**
33
+ * If el is passed as argument, events will only be applied to
34
+ * elements within el. Otherwise applied to document body.
35
+ */
36
+ applyEvents: function(el) {
37
+ el = $(el || document.body);
38
+ var apply = function(selector, action, callback) {
39
+ el.getElements(selector).addEvent(action, callback);
40
+ };
41
+
42
+ apply('form[data-remote="true"]', 'submit', rails.handleRemote);
43
+ apply('a[data-remote="true"], input[data-remote="true"]', 'click', rails.handleRemote);
44
+ apply('a[data-method][data-remote!=true]', 'click', function(e) {
45
+ e.preventDefault();
46
+ if(rails.confirmed(this)) {
47
+ var form = new Element('form', {
48
+ method: 'post',
49
+ action: this.get('href'),
50
+ styles: { display: 'none' }
51
+ }).inject(this, 'after');
52
+
53
+ var methodInput = new Element('input', {
54
+ type: 'hidden',
55
+ name: '_method',
56
+ value: this.get('data-method')
57
+ });
58
+
59
+ var csrfInput = new Element('input', {
60
+ type: 'hidden',
61
+ name: rails.csrf.param,
62
+ value: rails.csrf.token
63
+ });
64
+
65
+ form.adopt(methodInput, csrfInput).submit();
66
+ }
67
+ });
68
+ var noMethodNorRemoteConfirm = ':not([data-method]):not([data-remote=true])[data-confirm]';
69
+ apply('a' + noMethodNorRemoteConfirm + ',' + 'input' + noMethodNorRemoteConfirm, 'click', function() {
70
+ return rails.confirmed(this);
71
+ });
72
+ },
73
+
74
+ getCsrf: function(name) {
75
+ var meta = document.getElement('meta[name=csrf-' + name + ']');
76
+ return (meta ? meta.get('content') : null);
77
+ },
78
+
79
+ confirmed: function(el) {
80
+ var confirmMessage = el.get('data-confirm');
81
+ if(confirmMessage && !confirm(confirmMessage)) {
82
+ return false;
83
+ }
84
+ return true;
85
+ },
86
+
87
+ disable: function(el) {
88
+ var button = el.get('data-disable-with') ? el : el.getElement('[data-disable-with]');
89
+
90
+ if(button) {
91
+ var enableWith = button.get('value');
92
+ el.addEvent('ajax:complete', function() {
93
+ button.set({
94
+ value: enableWith,
95
+ disabled: false
96
+ });
97
+ });
98
+ button.set({
99
+ value: button.get('data-disable-with'),
100
+ disabled: true
101
+ });
102
+ }
103
+ },
104
+
105
+ handleRemote: function(e) {
106
+ e.preventDefault();
107
+
108
+ if(rails.confirmed(this)) {
109
+ this.request = new Request.Rails(this);
110
+ rails.disable(this);
111
+ this.request.send();
112
+ }
113
+ }
114
+ };
115
+
116
+ Request.Rails = new Class({
117
+
118
+ Extends: Request,
119
+
120
+ initialize: function(element, options) {
121
+ this.el = element;
122
+ this.parent(Object.merge({
123
+ method: this.el.get('method') || this.el.get('data-method') || 'get',
124
+ url: this.el.get('action') || this.el.get('href')
125
+ }, options));
126
+
127
+ this.addRailsEvents();
128
+ },
129
+
130
+ send: function(options) {
131
+ this.el.fireEvent('ajax:before');
132
+ if(this.el.get('tag') == 'form') {
133
+ this.options.data = this.el;
134
+ }
135
+ this.parent(options);
136
+ this.el.fireEvent('ajax:after', this.xhr);
137
+ },
138
+
139
+ addRailsEvents: function() {
140
+ this.addEvent('request', function() {
141
+ this.el.fireEvent('ajax:loading', this.xhr);
142
+ });
143
+
144
+ this.addEvent('success', function() {
145
+ this.el.fireEvent('ajax:success', this.xhr);
146
+ });
147
+
148
+ this.addEvent('complete', function() {
149
+ this.el.fireEvent('ajax:complete', this.xhr);
150
+ this.el.fireEvent('ajax:loaded', this.xhr);
151
+ });
152
+
153
+ this.addEvent('failure', function() {
154
+ this.el.fireEvent('ajax:failure', this.xhr);
155
+ });
156
+ }
157
+
158
+ });
159
+
160
+ })(document.id);
161
+
@@ -0,0 +1,10 @@
1
+ namespace :compile do
2
+ desc 'Compile ans compress application javascripts and stylesheets.'
3
+ task :update => :environment do
4
+ # Update stylesheets
5
+ Rake::Task['sass:update'].execute
6
+
7
+ # Pack all assets!
8
+ Jammit.package!
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ namespace :sass do
2
+ desc 'Updates stylesheets if necessary from their Sass templates.'
3
+ task :update => :environment do
4
+ sh "rm -rf public/assets/compiled/stylesheets tmp/sass-cache"
5
+ Sass::Plugin.options[:never_update] = false
6
+ Sass::Plugin.update_stylesheets
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ require 'compass'
3
+ Compass::Frameworks.register("playmo", :path => "#{File.dirname(__FILE__)}/..")
4
+
5
+ if defined?(ActionController)
6
+ require File.join(File.dirname(__FILE__), 'app', 'helpers', 'playmo_helper')
7
+ ActionController::Base.helper(PlaymoHelper)
8
+ end
9
+
10
+ module Playmo
11
+ #autoload :Generators, 'playmo/generators/base'
12
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.version = "0.0.5"
6
+ s.name = "playmo"
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Andrew Kozloff"]
9
+ s.email = ["andrew@tanraya.com"]
10
+ s.homepage = "https://github.com/tanraya/playmo"
11
+ s.summary = %q{Special kit that allows you create Rails 3 apps quick with pre-included few useful libs in your app.}
12
+
13
+ s.rubyforge_project = "playmo"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+ s.has_rdoc = false
20
+ s.rubygems_version = %q{1.3.7}
21
+ s.add_dependency("compass", [">= 0.10.6"])
22
+ end
@@ -0,0 +1,13 @@
1
+ @import "html5-boilerplate/reset";
2
+ @import "html5-boilerplate/fonts";
3
+ @import "html5-boilerplate/styles";
4
+ @import "html5-boilerplate/helpers";
5
+ @import "html5-boilerplate/media";
6
+
7
+ @mixin html5-boilerplate {
8
+ @include html5-boilerplate-reset;
9
+ @include html5-boilerplate-fonts;
10
+ @include html5-boilerplate-styles;
11
+ @include html5-boilerplate-helpers;
12
+ @include html5-boilerplate-media;
13
+ }
@@ -0,0 +1,46 @@
1
+ $base-font-family: unquote("sans-serif") !default;
2
+ $base-font-size: 13px !default;
3
+ $base-line-height: 1.231 !default;
4
+
5
+ //
6
+ // Font normalization inspired by from the YUI Library's fonts.css: developer.yahoo.com/yui
7
+ // Whatever parts of this port of YUI to Sass that are copyrightable, are Copyright (c) 2008, Christopher Eppstein. All Rights Reserved.
8
+ //
9
+
10
+ @mixin html5-boilerplate-fonts($family: $base-font-family, $size: $base-font-size, $line-height: $base-line-height) {
11
+ body {
12
+ font-size: $size;
13
+ font-family: $family;
14
+ line-height: $line-height; // hack retained to preserve specificity
15
+ *font-size: small;
16
+ }
17
+
18
+ select, input, textarea, button { font: 99% $family; }
19
+
20
+ // normalize monospace sizing
21
+ // meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/
22
+ // en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome
23
+ pre, code, kbd, samp { font-family: monospace, sans-serif; }
24
+ }
25
+
26
+ // maxvoltar.com/archive/-webkit-font-smoothing
27
+ @mixin font-smoothing {
28
+ -webkit-font-smoothing: antialiased;
29
+ }
30
+
31
+ // Sets the font size specified in pixels using percents so that the base
32
+ // font size changes and 1em has the correct value. When nesting font size
33
+ // declarations, within the DOM tree, the base_font_size must be the parent's
34
+ // effective font-size in pixels.
35
+ // Usage Examples:
36
+ // .big
37
+ // +font-size(16px)
38
+ // .bigger
39
+ // +font-size(18px)
40
+ // .big .bigger
41
+ // +font-size(18px, 16px)
42
+ //
43
+ // For more information see the table found at http://developer.yahoo.com/yui/3/cssfonts/#fontsize
44
+ @mixin font-size($size, $base-font-size: $base-font-size) {
45
+ font-size: ceil(percentage($size / $base-font-size));
46
+ }
@@ -0,0 +1,8 @@
1
+ * {
2
+ float: none; // Screens are not big enough to account for floats
3
+ background: #fff; // As much contrast as possible */
4
+ color: #000;
5
+ }
6
+
7
+ // Slightly reducing font size to reduce need to scroll
8
+ body { font-size: 80%; }
@@ -0,0 +1,57 @@
1
+ @import "compass/utilities/text/replacement";
2
+ @import "compass/utilities/general/clearfix";
3
+
4
+ //
5
+ // Non-semantic helper classes
6
+ // It's better to include these mixins in your own styles
7
+ //
8
+
9
+ @mixin html5-boilerplate-helpers {
10
+ .ir { @include image-replacement; }
11
+
12
+ .hidden { @include hidden; }
13
+
14
+ .visuallyhidden { @include visually-hidden; }
15
+
16
+ .clearfix { @include pie-clearfix; }
17
+ }
18
+
19
+ // Almost the same as compass replace-text
20
+ // but adding direction: ltr
21
+ @mixin image-replacement($img: none, $x: 50%, $y: 50%) {
22
+ @include hide-text;
23
+ direction: ltr;
24
+ background-repeat: no-repeat;
25
+ @if $img != none {
26
+ background-image: image-url($img);
27
+ background-position: $x $y;
28
+ }
29
+ }
30
+
31
+ @mixin sized-image-replacement($img, $x: 50%, $y: 50%) {
32
+ @include image-replacement($img, $x, $y);
33
+ width: image-width($img);
34
+ height: image-height($img);
35
+ }
36
+
37
+ // Hide for both screenreaders and browsers
38
+ // css-discuss.incutio.com/wiki/Screenreader_Visibility
39
+ @mixin hidden {
40
+ display:none;
41
+ visibility: hidden;
42
+ }
43
+
44
+ // Hide only visually, but have it available for screenreaders: by Jon Neal
45
+ // www.webaim.org/techniques/css/invisiblecontent/ & j.mp/visuallyhidden
46
+ @mixin visually-hidden {
47
+ border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px;
48
+ }
49
+
50
+ // Hide visually and from screenreaders, but maintain layout
51
+ @mixin invisible { visibility: hidden; }
52
+
53
+ // The Magnificent CLEARFIX << j.mp/phayesclearfix
54
+ @mixin magnificent-clearfix {
55
+ @warn "The 'magnificent-clearfix' mixin has been deprecated. Use 'pie-clearfix' in compass core instead.";
56
+ @include pie-clearfix;
57
+ }
@@ -0,0 +1,60 @@
1
+ @mixin html5-boilerplate-media {
2
+ @media print {
3
+ @include media-print;
4
+ }
5
+
6
+ @media all and (orientation:portrait) {
7
+ @include media-orientation-portrait;
8
+ }
9
+
10
+ @media all and (orientation:landscape) {
11
+ @include media-orientation-landscape;
12
+ }
13
+
14
+ @media screen and (max-device-width: 480px) {
15
+ @include media-mobile;
16
+ }
17
+ }
18
+
19
+ //
20
+ // print styles
21
+ // inlined to avoid required HTTP connection www.phpied.com/delay-loading-your-print-css/
22
+
23
+ @mixin media-print {
24
+ * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important;
25
+ -ms-filter: none !important; } // black prints faster: sanbeiji.com/archives/953
26
+ a, a:visited { color: #444 !important; text-decoration: underline; }
27
+ a[href]:after { content: " (" attr(href) ")"; }
28
+ abbr[title]:after { content: " (" attr(title) ")"; }
29
+ .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } // don't show links for images, or javascript/internal links
30
+ pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
31
+ thead { display: table-header-group; } // css-discuss.incutio.com/wiki/Printing_Tables
32
+ tr, img { page-break-inside: avoid; }
33
+ @page { margin: 0.5cm; }
34
+ p, h2, h3 { orphans: 3; widows: 3; }
35
+ h2, h3{ page-break-after: avoid; }
36
+ }
37
+
38
+
39
+ //
40
+ // media queries for responsive design
41
+ // these follow after primary styles so they will successfully override.
42
+ //
43
+
44
+ @mixin media-orientation-portrait {
45
+ // Style adjustments for portrait mode goes here
46
+ }
47
+
48
+ @mixin media-orientation-landscape {
49
+ // Style adjustments for landscape mode goes here
50
+ }
51
+
52
+ // Grade-A Mobile Browsers (Opera Mobile, Mobile Safari, Android Chrome)
53
+ // consider this: www.cloudfour.com/css-media-query-for-mobile-is-fools-gold
54
+ @mixin media-mobile($optimize: true) {
55
+ // j.mp/textsizeadjust
56
+ @if not $optimize {
57
+ // don't allow iOS and WinMobile to mobile-optimize text
58
+ html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; }
59
+ }
60
+ }
@@ -0,0 +1,56 @@
1
+ //
2
+ // style.css contains a reset, font normalization and some base styles.
3
+ //
4
+ // credit is left where credit is due.
5
+ // much inspiration was taken from these projects:
6
+ // yui.yahooapis.com/2.8.1/build/base/base.css
7
+ // camendesign.com/design/
8
+ // praegnanz.de/weblog/htmlcssjs-kickstart
9
+ //
10
+ // html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
11
+ // v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
12
+ // html5doctor.com/html-5-reset-stylesheet/
13
+ //
14
+
15
+ @mixin html5-boilerplate-reset {
16
+ html, body, div, span, object, iframe,
17
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
18
+ abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
19
+ small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
20
+ fieldset, form, label, legend,
21
+ table, caption, tbody, tfoot, thead, tr, th, td,
22
+ article, aside, canvas, details, figcaption, figure,
23
+ footer, header, hgroup, menu, nav, section, summary,
24
+ time, mark, audio, video {
25
+ margin:0;
26
+ padding:0;
27
+ border:0;
28
+ font-size:100%;
29
+ font: inherit;
30
+ vertical-align:baseline;
31
+ }
32
+
33
+ article, aside, details, figcaption, figure,
34
+ footer, header, hgroup, menu, nav, section {
35
+ display: block;
36
+ }
37
+
38
+ blockquote, q { quotes: none; }
39
+
40
+ blockquote:before, blockquote:after,
41
+ q:before, q:after { content:''; content:none; }
42
+
43
+ ins { background-color: #ff9; color: #000; text-decoration:none; }
44
+
45
+ mark { background-color: #ff9; color: #000; font-style:italic; font-weight:bold; }
46
+
47
+ del { text-decoration: line-through; }
48
+
49
+ abbr[title], dfn[title] { border-bottom:1px dotted; cursor:help; }
50
+
51
+ table { border-collapse:collapse; border-spacing:0; }
52
+
53
+ hr { display: block; height:1px; border:0; border-top:1px solid #ccc; margin:1em 0; padding:0; }
54
+
55
+ input, select { vertical-align:middle; }
56
+ }