speedo 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  //= require jquery-ui
2
- //= require speedo/bootstrap
2
+ //= require bootstrap
3
3
  //= require speedo/chosen.jquery
4
4
  //= require speedo/jquery.autoSuggest
5
5
  //= require speedo/jquery.autogrow
@@ -1,9 +1,4 @@
1
1
  $ ->
2
- # For Web-app mode, uncomment this (and the CSS in speedo/layout.css.scss) to make the cols fill the browser
3
- # $('.col1, .col2, .col3').css('height',$(window).height() - $('.main_nav').outerHeight() - $('.branding').outerHeight() - 60 + 'px')
4
- # $(window).resize ->
5
- # $('.col1, .col2, .col3').css('height',$(window).height() - $('.main_nav').outerHeight() - $('.branding').outerHeight() - 60 + 'px')
6
-
7
2
  $('.tip').livequery ->
8
3
  $(@).tooltip()
9
4
 
@@ -17,11 +12,14 @@ $ ->
17
12
  $(@).chosen()
18
13
 
19
14
  $('input, textarea').livequery ->
20
- $(@).placeholder()
15
+ $(@).not('input[type=password]').placeholder()
21
16
 
22
17
  $("select, input:checkbox, input:radio, input:file").livequery ->
23
18
  $(@).not('.hidden').not('.chzn').not('.bare').uniform()
24
19
 
20
+ $("form").livequery ->
21
+ $(@).preventDoubleSubmission()
22
+
25
23
  $('input[type=date]').livequery ->
26
24
  $(@).not('.bare').datepicker
27
25
  numberOfMonths: 2
@@ -51,3 +49,16 @@ $ ->
51
49
  { "bSortable": false, "aTargets": [ -1 ] }
52
50
  ]
53
51
  # "bJQueryUI": true # Use jQueryUI styling
52
+
53
+
54
+ jQuery.fn.preventDoubleSubmission = ->
55
+ $form = $(this)
56
+ $form.bind "submit", (e) ->
57
+ if $form.data("submitted") is true
58
+ e.preventDefault()
59
+ else
60
+ $form.data "submitted", true
61
+ $form.find('input[type=submit], button').attr('disabled', 'disabled')
62
+ $form.ajaxComplete ->
63
+ $form.data "submitted", false
64
+ $form.find('input[type=submit], button').removeAttr('disabled')
@@ -2,11 +2,14 @@
2
2
  * {
3
3
  @include box-sizing(border-box);
4
4
  }
5
- body {
6
- color: $text;
5
+ html {
7
6
  background: $bg;
7
+ }
8
+ body {
8
9
  font-size:12px;
9
10
  line-height:1.231;
11
+ color: $text;
12
+ background: $bg;
10
13
  }
11
14
  a, a:visited:not(.btn), .link {
12
15
  color: $link;
@@ -44,7 +47,7 @@ input:not(.btn), textarea {
44
47
  }
45
48
  footer {
46
49
  position:relative;
47
- margin:-1.8em 10px 0 0; /* So it appears at the bottom of the right column and is not lost in web-app mode */
50
+ margin:-1em 10px 0 0; /* So it appears within #main */
48
51
  float: right;
49
52
  font-size: 0.8em;
50
53
  opacity:0.5;
@@ -1,8 +1,9 @@
1
1
  /* Error messages */
2
2
  .flash {
3
3
  position:relative;
4
+ border:1px solid rgba(0,0,0,0.1);
5
+ border-width:1px 0;
4
6
  padding:0.5em 2em;
5
- box-shadow:0 2px 2px #999;
6
7
  font-size:1.5em;
7
8
  text-align:center;
8
9
  text-shadow:-1px -1px 1px #FFFFFF, 1px 1px 1px rgba(0, 0, 0, 0.3);
@@ -1,14 +1,13 @@
1
1
  @import 'bootstrap';
2
+ @import 'bootstrap-responsive';
2
3
  @import 'autoSuggest';
3
4
  @import 'chosen';
4
5
  @import 'jquery.dataTables';
5
6
  @import 'jquery-ui-1.8.18.custom';
6
7
  @import 'uniform.default';
7
- @import 'bourbon';
8
8
 
9
9
  @import 'speedo/theme';
10
10
  @import 'speedo/base';
11
- @import 'speedo/layout';
12
11
  @import 'speedo/plugins';
13
12
  @import 'speedo/helpers';
14
13
 
@@ -8,55 +8,13 @@ $bggreen: #e3fde4;
8
8
  $bgblue: #bcf;
9
9
  $bgyellow: #ffc;
10
10
  $bgred: #f99;
11
- /* Column background colors, layout.css */
12
- $maincolbg: #fff;
13
- $leftcolbg: #f6f6f6;
14
- $rightcolbg: #fafafa;
11
+ /* Main column background color, below */
12
+ $mainbg: #fff;
15
13
 
16
-
17
- .branding {
18
- padding:5px 0;
19
- background:#eee;
20
- .logo {
21
- float: left;
22
- margin-left:2%;
23
- img {
24
- display:block;
25
- height: 40px;
26
- }
27
- }
28
- .user {
29
- float:right;
30
- margin:10px 2% 0;
31
- a {
32
- }
33
- .user-name {
34
- }
35
- .user-logout {
36
- }
37
- }
38
- }
39
-
40
-
41
- .main_nav {
42
- padding:5px 0;
43
- background:#eee;
44
- .search {
45
- margin-right:10px;
46
- }
47
- .home {
48
- margin-left:10px;
49
- }
50
- a {
51
- display:inline-block; zoom:1;*display:inline;
52
- padding:0.2em 0.5em;
53
- background:#ccc;
54
- @include border-radius(0.3em);
55
- &:hover {
56
- background:#ddd;
57
- }
58
- &.active {
59
- @include box-shadow(inset 0 1px 2px rgba(0,0,0,0.5));
60
- }
61
- }
14
+ #main {
15
+ margin:0 -20px 20px;
16
+ border-radius:1em;
17
+ padding:20px;
18
+ box-shadow:0 0px 5px 1px #999;
19
+ background: $mainbg;
62
20
  }
@@ -0,0 +1,23 @@
1
+ .navbar
2
+ .navbar-inner
3
+ .container
4
+ = link_to image_tag('speedo/logo.png'), root_url, class: 'brand'
5
+ %a.btn.btn-navbar{data: {toggle:"collapse", target:".nav-collapse"} }
6
+ - 3.times do
7
+ %span.icon-bar
8
+ %form.navbar-search.pull-right
9
+ %input{type: 'search', name: 'search[name]', placeholder: 'Search', results: 5, autosave: 'site_search', class: 'search-query'}
10
+ .nav-collapse.collapse
11
+ %ul.nav
12
+ %li.active= link_to 'Home', root_url, {class: 'active home'}
13
+ %li= link_to 'Section1', root_url
14
+ %li= link_to 'Section2', root_url
15
+ %li= link_to 'Section3', root_url
16
+ %li= link_to 'Section4', root_url
17
+ %ul.nav.pull-right
18
+ - if @user_signed_in
19
+ %li= link_to 'current_user.name', 'account_url', class: 'user_name'
20
+ %li= link_to 'Logout', 'destroy_user_session_url', class: 'user_logout'
21
+ - else
22
+ %li= link_to 'Sign in', 'new_user_session_path', rel: 'sign_in'
23
+ %li= link_to 'Sign up', 'new_user_registration_path', rel: 'sign_up'
@@ -24,52 +24,17 @@
24
24
  %body
25
25
  %noscript
26
26
  #noscript_warning This site works best with JavaScript enabled. Some features may not be available
27
- #wrapper.clearfix
28
- %header.branding.clearfix
29
- = link_to image_tag('speedo/logo.png'), root_url, class: 'logo'
30
-
31
- .user
32
- - if @user_signed_in
33
- = link_to 'current_user.name', 'account_url', class: 'user_name'
34
- |
35
- = link_to 'Logout', 'destroy_user_session_url', class: 'user_logout'
36
- - else
37
- = link_to 'Sign in', 'new_user_session_path', rel: 'sign_in'
38
- or
39
- = link_to 'Sign up', 'new_user_registration_path', rel: 'sign_up'
40
-
41
- %nav.main_nav.clearfix
42
- %form.right.search
43
- %input{type: 'search', name: 'search[name]', placeholder: 'Search', results: 5, autosave: 'site_search'}
44
-
45
- = link_to 'Home', root_url, {class: 'active home'}
46
- = link_to 'Section1', root_url
47
- = link_to 'Section2', root_url
48
- = link_to 'Section3', root_url
49
- = link_to 'Section4', root_url
50
-
51
-
52
- - if flash[:success]
53
- .flash.success= flash[:success]
54
- - if flash[:notice]
55
- .flash.notice= flash[:notice]
56
- - if flash[:alert]
57
- .flash.alert= flash[:alert]
58
- - if flash[:error]
59
- .flash.error= flash[:error]
60
- .colmask{class: @col_layout || @col_layout = 'leftcol'}
61
- -# options: leftcol, rightcol, threecol, onecol
62
- .colmid
63
- .colleft
64
- .col1
65
- = yield
66
- .col2
67
- = yield :left_col
68
- .col3
69
- = yield :right_col
70
- = yield :popups
71
- %footer
72
- Copyright ©
73
- = Time.now.year
74
- = link_to 'CrankApps', 'http://www.crankapps.com', target: '_blank'
27
+ #wrapper
28
+ = render 'layouts/speedo/navbar'
29
+ .container
30
+ #main
31
+ - [:success, :notice, :alert, :error].each do |f|
32
+ - if flash[f]
33
+ .flash{class: f}= flash[f]
34
+ = yield
35
+ = yield :popups
36
+ %footer
37
+ Copyright ©
38
+ = Time.now.year
39
+ = link_to 'CrankApps', 'http://www.crankapps.com', target: '_blank'
75
40
 
@@ -1,102 +1,102 @@
1
- - @col_layout = 'threecol'
2
-
3
- %h1 Forms with Uniform, AutoGrowing, AutoSuggesting - h1
4
- = semantic_form_for 'speedo' do |f|
5
- / = f.semantic_errors
6
- = f.inputs do
7
- .row-fluid
8
- = f.input 'Title', placeholder: 'Type your title', wrapper_html: {class: 'span6'}
9
- = f.input 'Name', wrapper_html: {class: 'span6'}
10
- = f.input 'Singer', input_html: { class: 'autoSuggest' }
11
- = f.input 'Description', as: :text, input_html: { placeholder: 'AutoGrowing', class: 'autogrow tip', :rows => 2, title: 'Tip: you can type what you like, and this will get bigger to fit!', data: {placement: 'bottom'} }
12
- = f.input 'Attachment', as: :file, required: false
13
- = f.input 'Select', as: :select, include_blank: false, hint: 'Just select one!'
14
- = f.input 'Are you real?', as: :radio, wrapper_html: { class: 'inline_choices' }
15
- = f.input 'Which do you own?', as: :check_boxes, collection: ['Speedo','Swim Short','Bikini']
1
+ .row
2
+ .span3
3
+ %h2 Left Col
4
+ %button.btn.spin_me Start spinner
5
+ %script
6
+ $('.spin_me').toggle(function() {
7
+ $(this).spin('large','#0090D5');
8
+ }, function() {
9
+ $(this).spin(false);
10
+ });
11
+
12
+ .span6
13
+ %h1 Forms with Uniform, AutoGrowing, AutoSuggesting - h1
14
+ = semantic_form_for 'speedo' do |f|
15
+ / = f.semantic_errors
16
+ = f.inputs do
17
+ .row-fluid
18
+ = f.input 'Title', placeholder: 'Type your title', wrapper_html: {class: 'span6'}
19
+ = f.input 'Name', wrapper_html: {class: 'span6'}
20
+ = f.input 'Singer', input_html: { class: 'autoSuggest' }
21
+ = f.input 'Description', as: :text, input_html: { placeholder: 'AutoGrowing', class: 'autogrow tip', :rows => 2, title: 'Tip: you can type what you like, and this will get bigger to fit!', data: {placement: 'bottom'} }
22
+ = f.input 'Attachment', as: :file, required: false
23
+ = f.input 'Select', as: :select, include_blank: false, hint: 'Just select one!'
24
+ = f.input 'Are you real?', as: :radio, wrapper_html: { class: 'inline_choices' }
25
+ = f.input 'Which do you own?', as: :check_boxes, collection: ['Speedo','Swim Short','Bikini']
16
26
 
17
- %hr
18
- %h2 Buttons - h2
19
- = f.actions do
20
- = f.action :submit, label: 'Submit', as: :button, button_html: { class: 'btn left' }
21
- = f.action :cancel, label: 'Cancel', as: :link, button_html: { class: 'btn btn-danger left' }
22
- .btn-group
23
- %button.btn.btn-success
24
- %i.icon-plus.icon-white
25
- Plus icon
26
- %button.btn
27
- %i.icon-cog
28
- Cog icon
29
- %button.btn.btn-danger
30
- %i.icon-remove.icon-white
31
- Remove icon
32
- = link_to 'Bootstrap buttons docs', 'http://twitter.github.com/bootstrap/base-css.html#buttons', target: '_blank'
33
-
34
- %hr
35
- %h3 Sortable dataTable - h3
36
- %table.dataTable
37
- %thead
38
- %tr
39
- %th Name
40
- %th Username
41
- %tbody
42
- %tr
43
- %td Sally
44
- %td gurlsally
45
- %tr
46
- %td Dave
47
- %td davieboy
48
- %tr
49
- %td Hilary
50
- %td hermahili
51
-
52
- %hr
53
- %h4 Inputs with bonuses - h4
54
- %select.chzn{style: 'width:200px'}
55
- %option Canada
56
- %option UK
57
- %option USA
58
-
59
- %br
60
- %input{type: :date, placeholder: 'yy-mm-dd'}
61
-
62
- %hr
63
- %h5 Lists - h5
64
- %ul
65
- %li This is a list:
66
- %li no margin
67
- %li or padding
68
- %li or bullets
69
- %li (you'll need to add them back when you need 'em)
70
-
71
- %hr
72
- %h6 Time - h6
73
- %pre.ib %time.ago{datetime: Time.now.iso8601}
74
- results in telling us when this page was loaded:
75
- %time.ago.notice.flash.tip{datetime: Time.now.iso8601, title: Time.now.to_s(:long)}
76
- %p Note: make sure you use iso8601 or you'll get errors!
77
-
78
-
79
-
80
-
81
-
82
-
83
- = content_for :left_col do
84
- %h2 Left Col
85
- %button.btn.spin_me Start spinner
86
- %script
87
- $('.spin_me').toggle(function() {
88
- $(this).spin('large','#0090D5');
89
- }, function() {
90
- $(this).spin(false);
91
- });
92
-
93
- = content_for :right_col do
94
- %h3 Right Col
95
- %a.btn{href: '#modal', data: {toggle: 'modal', backdrop: 'static'}} Modal
96
- %br
97
- %button.btn{data: {toggle: 'modal', target: '#popup'}} Popup Help!
98
- %br
99
- = link_to 'External Popup', '/', class: 'btn', data: {toggle: 'modal', target: '#external'}
27
+ %hr
28
+ %h2 Buttons - h2
29
+ = f.actions do
30
+ = f.action :submit, label: 'Submit', as: :button, button_html: { class: 'btn left' }
31
+ = f.action :cancel, label: 'Cancel', as: :link, button_html: { class: 'btn btn-danger left' }
32
+ .btn-group
33
+ %button.btn.btn-success
34
+ %i.icon-plus.icon-white
35
+ Plus icon
36
+ %button.btn
37
+ %i.icon-cog
38
+ Cog icon
39
+ %button.btn.btn-danger
40
+ %i.icon-remove.icon-white
41
+ Remove icon
42
+ = link_to 'Bootstrap buttons docs', 'http://twitter.github.com/bootstrap/base-css.html#buttons', target: '_blank'
43
+
44
+ %hr
45
+ %h3 Sortable dataTable - h3
46
+ %table.dataTable
47
+ %thead
48
+ %tr
49
+ %th Name
50
+ %th Username
51
+ %tbody
52
+ %tr
53
+ %td Sally
54
+ %td gurlsally
55
+ %tr
56
+ %td Dave
57
+ %td davieboy
58
+ %tr
59
+ %td Hilary
60
+ %td hermahili
61
+
62
+ %hr
63
+ %h4 Inputs with bonuses - h4
64
+ %select.chzn{style: 'width:200px'}
65
+ %option Canada
66
+ %option UK
67
+ %option USA
68
+
69
+ %br
70
+ %input{type: :date, placeholder: 'yy-mm-dd'}
71
+
72
+ %hr
73
+ %h5 Lists - h5
74
+ %ul
75
+ %li This is a list:
76
+ %li no margin
77
+ %li or padding
78
+ %li or bullets
79
+ %li (you'll need to add them back when you need 'em)
80
+
81
+ %hr
82
+ %h6 Time - h6
83
+ %pre.ib %time.ago{datetime: Time.now.iso8601}
84
+ results in telling us when this page was loaded:
85
+ %time.ago.notice.flash.tip{datetime: Time.now.iso8601, title: Time.now.to_s(:long)}
86
+ %p Note: make sure you use iso8601 or you'll get errors!
87
+
88
+
89
+
90
+
91
+
92
+
93
+ .span3
94
+ %h3 Right Col
95
+ %a.btn{href: '#modal', data: {toggle: 'modal', backdrop: 'static'}} Modal
96
+ %br
97
+ %button.btn{data: {toggle: 'modal', target: '#popup'}} Popup Help!
98
+ %br
99
+ = link_to 'External Popup', '/', class: 'btn', data: {toggle: 'modal', target: '#external'}
100
100
 
101
101
 
102
102
  = content_for :popups do
@@ -23,10 +23,20 @@ module Speedo
23
23
  end
24
24
  end
25
25
  end
26
+
27
+ def navbar
28
+ template 'app/views/layouts/speedo/_navbar.html.haml',
29
+ 'app/views/layouts/_navbar.html.haml'
30
+ if_file 'app/views/layouts/application.html.haml' do |path|
31
+ if File.read(path).match /render 'layouts\/speedo\/navbar'/
32
+ gsub_file path, /render 'layouts\/speedo\/navbar'/, "render 'layouts/navbar'"
33
+ end
34
+ end
35
+ end
26
36
 
27
37
  # app/assets/stylesheets/speedo.css.scss
28
38
  def copy_stylesheets
29
- css = ['speedo','base','layout','plugins','theme','helpers']
39
+ css = ['speedo','base','plugins','theme','helpers']
30
40
  css.each do |file|
31
41
  copy_file "app/assets/stylesheets/speedo/#{file}.css.scss",
32
42
  "app/assets/stylesheets/speedo/#{file}.css.scss"
@@ -1,3 +1,3 @@
1
1
  module Speedo
2
- VERSION = "0.3.4"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/speedo.rb CHANGED
@@ -5,6 +5,7 @@ require 'haml'
5
5
  require 'coffee-script'
6
6
  require 'formtastic'
7
7
  require 'formtastic-bootstrap'
8
+ require 'bootstrap-sass'
8
9
 
9
10
  module Speedo
10
11
  end