da-suspenders 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,30 @@
1
- source :rubygems
2
-
3
- gem "rails", "3.0.4"
4
- gem "mysql"
5
-
6
- gem "app_config", :git => "git://github.com/die-antwort/app_config.git"
7
- gem "compass", "~> 0.10.6"
8
- gem "formtastic", ">= 1.2.1"
9
- gem "hoptoad_notifier"
10
- gem "sprockets", "~> 1.0.2"
11
- gem "will_paginate"
12
-
13
- # Uncomment if you want to use any of those
14
- #gem "paperclip"
15
-
16
- # RSpec needs to be in :development group to expose generators
17
- # and rake tasks without having to type RAILS_ENV=test.
18
- group :development, :test do
19
- gem "rspec-rails", "~> 2.4.0"
20
- end
21
-
22
- group :test do
23
- gem "akephalos", :git => "git://github.com/die-antwort/akephalos.git"
24
- gem "cucumber-rails"
25
- gem "factory_girl_rails"
26
- gem "capybara"
27
- gem "database_cleaner"
28
- gem "launchy"
29
- gem "timecop"
30
- end
1
+ source :rubygems
2
+
3
+ gem "rails", "3.0.4"
4
+ gem "mysql"
5
+
6
+ gem "app_config", :git => "git://github.com/die-antwort/app_config.git"
7
+ gem "compass", "~> 0.10.6"
8
+ gem "formtastic", ">= 1.2.1"
9
+ gem "hoptoad_notifier"
10
+ gem "sprockets", "~> 1.0.2"
11
+ gem "will_paginate"
12
+
13
+ # Uncomment if you want to use any of those
14
+ #gem "paperclip"
15
+
16
+ # RSpec needs to be in :development group to expose generators
17
+ # and rake tasks without having to type RAILS_ENV=test.
18
+ group :development, :test do
19
+ gem "rspec-rails", "~> 2.4.0"
20
+ end
21
+
22
+ group :test do
23
+ gem "akephalos", :git => "git://github.com/die-antwort/akephalos.git"
24
+ gem "cucumber-rails"
25
+ gem "factory_girl_rails"
26
+ gem "capybara"
27
+ gem "database_cleaner"
28
+ gem "launchy"
29
+ gem "timecop"
30
+ end
@@ -1,6 +1,6 @@
1
- module BodyClassHelper
2
- def body_class
3
- qualified_controller_name = controller.controller_path.gsub('/','-')
4
- "#{qualified_controller_name} #{controller.action_name}"
5
- end
6
- end
1
+ module BodyClassHelper
2
+ def body_class
3
+ qualified_controller_name = controller.controller_path.gsub('/','-')
4
+ "#{qualified_controller_name} #{controller.action_name}"
5
+ end
6
+ end
@@ -1,10 +1,10 @@
1
- //= require <modernizr>
2
- //= require <jquery.min>
3
- //= require <rails>
4
-
5
- // activate if you want to use jrails:
6
- // = require <jquery-ui.min>
7
- // = require <jrails>
8
-
9
- // activate if you want to localize jQuery UI Datepicker:
10
- // = require <jquery-ui-i18n.min>
1
+ //= require <modernizr>
2
+ //= require <jquery.min>
3
+ //= require <rails>
4
+
5
+ // activate if you want to use jrails:
6
+ // = require <jquery-ui.min>
7
+ // = require <jrails>
8
+
9
+ // activate if you want to localize jQuery UI Datepicker:
10
+ // = require <jquery-ui-i18n.min>
@@ -1,16 +1,16 @@
1
- <!DOCTYPE html>
2
- <html lang="de" class="no-js">
3
- <head>
4
- <title>Testapp</title>
5
- <link href="/stylesheets/application.css" type="text/css" rel="stylesheet">
6
- <!--[if lte IE 7]><link href="/public/stylesheets/ie7.css" type="text/css" rel="stylesheet"><![endif]-->
7
- <%= sprockets_include_tag %>
8
- <%= javascript_tag "$.ajaxSetup({ async: false });" if Rails.env.test?%>
9
- <%= csrf_meta_tag %>
10
- </head>
11
- <body class="<%= body_class %>">
12
- <%= render :partial => "shared/flashes" %>
13
- <%= yield %>
14
- </body>
15
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="de" class="no-js">
3
+ <head>
4
+ <title>Testapp</title>
5
+ <link href="/stylesheets/application.css" type="text/css" rel="stylesheet">
6
+ <!--[if lte IE 7]><link href="/stylesheets/ie.css" type="text/css" rel="stylesheet"><![endif]-->
7
+ <%= sprockets_include_tag %>
8
+ <%= javascript_tag "$.ajaxSetup({ async: false });" if Rails.env.test?%>
9
+ <%= csrf_meta_tag %>
10
+ </head>
11
+ <body class="<%= body_class %>">
12
+ <%= render :partial => "shared/flashes" %>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
16
16
  <!-- Created with care by DIE ANTWORT · Büro für Informationstechnik GmbH -->
@@ -1,5 +1,5 @@
1
- <div id="flash">
2
- <% flash.each do |key, value| -%>
3
- <div id="flash_<%= key %>"><%= value %></div>
4
- <% end -%>
5
- </div>
1
+ <div id="flash">
2
+ <% flash.each do |key, value| -%>
3
+ <div id="flash_<%= key %>"><%= value %></div>
4
+ <% end -%>
5
+ </div>
@@ -1,26 +1,26 @@
1
- require 'net/smtp'
2
- # Example:
3
- # begin
4
- # some http call
5
- # rescue *HTTP_ERRORS => error
6
- # notify_hoptoad error
7
- # end
8
-
9
- HTTP_ERRORS = [Timeout::Error,
10
- Errno::EINVAL,
11
- Errno::ECONNRESET,
12
- EOFError,
13
- Net::HTTPBadResponse,
14
- Net::HTTPHeaderSyntaxError,
15
- Net::ProtocolError]
16
-
17
- SMTP_SERVER_ERRORS = [TimeoutError,
18
- IOError,
19
- Net::SMTPUnknownError,
20
- Net::SMTPServerBusy,
21
- Net::SMTPAuthenticationError]
22
-
23
- SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
24
- Net::SMTPSyntaxError]
25
-
26
- SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
1
+ require 'net/smtp'
2
+ # Example:
3
+ # begin
4
+ # some http call
5
+ # rescue *HTTP_ERRORS => error
6
+ # notify_hoptoad error
7
+ # end
8
+
9
+ HTTP_ERRORS = [Timeout::Error,
10
+ Errno::EINVAL,
11
+ Errno::ECONNRESET,
12
+ EOFError,
13
+ Net::HTTPBadResponse,
14
+ Net::HTTPHeaderSyntaxError,
15
+ Net::ProtocolError]
16
+
17
+ SMTP_SERVER_ERRORS = [TimeoutError,
18
+ IOError,
19
+ Net::SMTPUnknownError,
20
+ Net::SMTPServerBusy,
21
+ Net::SMTPAuthenticationError]
22
+
23
+ SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
24
+ Net::SMTPSyntaxError]
25
+
26
+ SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -1,3 +1,3 @@
1
- Then 'the javascript expression "$expression" should return "$result"' do |expression, result|
2
- page.evaluate_script(expression).to_s.should == result
3
- end
1
+ Then 'the javascript expression "$expression" should return "$result"' do |expression, result|
2
+ page.evaluate_script(expression).to_s.should == result
3
+ end
@@ -1,13 +1,13 @@
1
- <%%= semantic_form_for(@<%= singular_table_name %>) do |f| %>
2
- <%%= f.semantic_errors %>
3
-
4
- <%% f.inputs do %>
5
- <% for attribute in attributes -%>
6
- <%%= f.input :<%= attribute.name %> %>
7
- <% end -%>
8
- <%% end %>
9
-
10
- <%% f.buttons do %>
11
- <%%= f.commit_button %>
12
- <%% end %>
13
- <%% end %>
1
+ <%%= semantic_form_for(@<%= singular_table_name %>) do |f| %>
2
+ <%%= f.semantic_errors %>
3
+
4
+ <%%= f.inputs do %>
5
+ <% for attribute in attributes -%>
6
+ <%%= f.input :<%= attribute.name %> %>
7
+ <% end -%>
8
+ <%% end %>
9
+
10
+ <%%= f.buttons do %>
11
+ <%%= f.commit_button %>
12
+ <%% end %>
13
+ <%% end %>
@@ -1,169 +1,169 @@
1
- /**
2
- * Unobtrusive scripting adapter for jQuery
3
- *
4
- * Requires jQuery 1.4.3 or later.
5
- * https://github.com/rails/jquery-ujs
6
- */
7
-
8
- (function($) {
9
- // Make sure that every Ajax request sends the CSRF token
10
- function CSRFProtection(fn) {
11
- var token = $('meta[name="csrf-token"]').attr('content');
12
- if (token) fn(function(xhr) { xhr.setRequestHeader('X-CSRF-Token', token) });
13
- }
14
- if ($().jquery == '1.5') { // gruesome hack
15
- var factory = $.ajaxSettings.xhr;
16
- $.ajaxSettings.xhr = function() {
17
- var xhr = factory();
18
- CSRFProtection(function(setHeader) {
19
- var open = xhr.open;
20
- xhr.open = function() { open.apply(this, arguments); setHeader(this) };
21
- });
22
- return xhr;
23
- };
24
- }
25
- else $(document).ajaxSend(function(e, xhr) {
26
- CSRFProtection(function(setHeader) { setHeader(xhr) });
27
- });
28
-
29
- // Triggers an event on an element and returns the event result
30
- function fire(obj, name, data) {
31
- var event = new $.Event(name);
32
- obj.trigger(event, data);
33
- return event.result !== false;
34
- }
35
-
36
- // Submits "remote" forms and links with ajax
37
- function handleRemote(element) {
38
- var method, url, data,
39
- dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
40
-
41
- if (element.is('form')) {
42
- method = element.attr('method');
43
- url = element.attr('action');
44
- data = element.serializeArray();
45
- // memoized value from clicked submit button
46
- var button = element.data('ujs:submit-button');
47
- if (button) {
48
- data.push(button);
49
- element.data('ujs:submit-button', null);
50
- }
51
- } else {
52
- method = element.attr('data-method');
53
- url = element.attr('href');
54
- data = null;
55
- }
56
-
57
- $.ajax({
58
- url: url, type: method || 'GET', data: data, dataType: dataType,
59
- // stopping the "ajax:beforeSend" event will cancel the ajax request
60
- beforeSend: function(xhr, settings) {
61
- if (settings.dataType === undefined) {
62
- xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
63
- }
64
- return fire(element, 'ajax:beforeSend', [xhr, settings]);
65
- },
66
- success: function(data, status, xhr) {
67
- element.trigger('ajax:success', [data, status, xhr]);
68
- },
69
- complete: function(xhr, status) {
70
- element.trigger('ajax:complete', [xhr, status]);
71
- },
72
- error: function(xhr, status, error) {
73
- element.trigger('ajax:error', [xhr, status, error]);
74
- }
75
- });
76
- }
77
-
78
- // Handles "data-method" on links such as:
79
- // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
80
- function handleMethod(link) {
81
- var href = link.attr('href'),
82
- method = link.attr('data-method'),
83
- csrf_token = $('meta[name=csrf-token]').attr('content'),
84
- csrf_param = $('meta[name=csrf-param]').attr('content'),
85
- form = $('<form method="post" action="' + href + '"></form>'),
86
- metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
87
-
88
- if (csrf_param !== undefined && csrf_token !== undefined) {
89
- metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
90
- }
91
-
92
- form.hide().append(metadata_input).appendTo('body');
93
- form.submit();
94
- }
95
-
96
- function disableFormElements(form) {
97
- form.find('input[data-disable-with]').each(function() {
98
- var input = $(this);
99
- input.data('ujs:enable-with', input.val())
100
- .val(input.attr('data-disable-with'))
101
- .attr('disabled', 'disabled');
102
- });
103
- }
104
-
105
- function enableFormElements(form) {
106
- form.find('input[data-disable-with]').each(function() {
107
- var input = $(this);
108
- input.val(input.data('ujs:enable-with')).removeAttr('disabled');
109
- });
110
- }
111
-
112
- function allowAction(element) {
113
- var message = element.attr('data-confirm');
114
- return !message || (fire(element, 'confirm') && confirm(message));
115
- }
116
-
117
- function requiredValuesMissing(form) {
118
- var missing = false;
119
- form.find('input[name][required]').each(function() {
120
- if (!$(this).val()) missing = true;
121
- });
122
- return missing;
123
- }
124
-
125
- $('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
126
- var link = $(this);
127
- if (!allowAction(link)) return false;
128
-
129
- if (link.attr('data-remote') != undefined) {
130
- handleRemote(link);
131
- return false;
132
- } else if (link.attr('data-method')) {
133
- handleMethod(link);
134
- return false;
135
- }
136
- });
137
-
138
- $('form').live('submit.rails', function(e) {
139
- var form = $(this), remote = form.attr('data-remote') != undefined;
140
- if (!allowAction(form)) return false;
141
-
142
- // skip other logic when required values are missing
143
- if (requiredValuesMissing(form)) return !remote;
144
-
145
- if (remote) {
146
- handleRemote(form);
147
- return false;
148
- } else {
149
- // slight timeout so that the submit button gets properly serialized
150
- setTimeout(function(){ disableFormElements(form) }, 13);
151
- }
152
- });
153
-
154
- $('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
155
- var button = $(this);
156
- if (!allowAction(button)) return false;
157
- // register the pressed submit button
158
- var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
159
- button.closest('form').data('ujs:submit-button', data);
160
- });
161
-
162
- $('form').live('ajax:beforeSend.rails', function(event) {
163
- if (this == event.target) disableFormElements($(this));
164
- });
165
-
166
- $('form').live('ajax:complete.rails', function(event) {
167
- if (this == event.target) enableFormElements($(this));
168
- });
169
- })( jQuery );
1
+ /**
2
+ * Unobtrusive scripting adapter for jQuery
3
+ *
4
+ * Requires jQuery 1.4.3 or later.
5
+ * https://github.com/rails/jquery-ujs
6
+ */
7
+
8
+ (function($) {
9
+ // Make sure that every Ajax request sends the CSRF token
10
+ function CSRFProtection(fn) {
11
+ var token = $('meta[name="csrf-token"]').attr('content');
12
+ if (token) fn(function(xhr) { xhr.setRequestHeader('X-CSRF-Token', token) });
13
+ }
14
+ if ($().jquery == '1.5') { // gruesome hack
15
+ var factory = $.ajaxSettings.xhr;
16
+ $.ajaxSettings.xhr = function() {
17
+ var xhr = factory();
18
+ CSRFProtection(function(setHeader) {
19
+ var open = xhr.open;
20
+ xhr.open = function() { open.apply(this, arguments); setHeader(this) };
21
+ });
22
+ return xhr;
23
+ };
24
+ }
25
+ else $(document).ajaxSend(function(e, xhr) {
26
+ CSRFProtection(function(setHeader) { setHeader(xhr) });
27
+ });
28
+
29
+ // Triggers an event on an element and returns the event result
30
+ function fire(obj, name, data) {
31
+ var event = new $.Event(name);
32
+ obj.trigger(event, data);
33
+ return event.result !== false;
34
+ }
35
+
36
+ // Submits "remote" forms and links with ajax
37
+ function handleRemote(element) {
38
+ var method, url, data,
39
+ dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
40
+
41
+ if (element.is('form')) {
42
+ method = element.attr('method');
43
+ url = element.attr('action');
44
+ data = element.serializeArray();
45
+ // memoized value from clicked submit button
46
+ var button = element.data('ujs:submit-button');
47
+ if (button) {
48
+ data.push(button);
49
+ element.data('ujs:submit-button', null);
50
+ }
51
+ } else {
52
+ method = element.attr('data-method');
53
+ url = element.attr('href');
54
+ data = null;
55
+ }
56
+
57
+ $.ajax({
58
+ url: url, type: method || 'GET', data: data, dataType: dataType,
59
+ // stopping the "ajax:beforeSend" event will cancel the ajax request
60
+ beforeSend: function(xhr, settings) {
61
+ if (settings.dataType === undefined) {
62
+ xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
63
+ }
64
+ return fire(element, 'ajax:beforeSend', [xhr, settings]);
65
+ },
66
+ success: function(data, status, xhr) {
67
+ element.trigger('ajax:success', [data, status, xhr]);
68
+ },
69
+ complete: function(xhr, status) {
70
+ element.trigger('ajax:complete', [xhr, status]);
71
+ },
72
+ error: function(xhr, status, error) {
73
+ element.trigger('ajax:error', [xhr, status, error]);
74
+ }
75
+ });
76
+ }
77
+
78
+ // Handles "data-method" on links such as:
79
+ // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
80
+ function handleMethod(link) {
81
+ var href = link.attr('href'),
82
+ method = link.attr('data-method'),
83
+ csrf_token = $('meta[name=csrf-token]').attr('content'),
84
+ csrf_param = $('meta[name=csrf-param]').attr('content'),
85
+ form = $('<form method="post" action="' + href + '"></form>'),
86
+ metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
87
+
88
+ if (csrf_param !== undefined && csrf_token !== undefined) {
89
+ metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
90
+ }
91
+
92
+ form.hide().append(metadata_input).appendTo('body');
93
+ form.submit();
94
+ }
95
+
96
+ function disableFormElements(form) {
97
+ form.find('input[data-disable-with]').each(function() {
98
+ var input = $(this);
99
+ input.data('ujs:enable-with', input.val())
100
+ .val(input.attr('data-disable-with'))
101
+ .attr('disabled', 'disabled');
102
+ });
103
+ }
104
+
105
+ function enableFormElements(form) {
106
+ form.find('input[data-disable-with]').each(function() {
107
+ var input = $(this);
108
+ input.val(input.data('ujs:enable-with')).removeAttr('disabled');
109
+ });
110
+ }
111
+
112
+ function allowAction(element) {
113
+ var message = element.attr('data-confirm');
114
+ return !message || (fire(element, 'confirm') && confirm(message));
115
+ }
116
+
117
+ function requiredValuesMissing(form) {
118
+ var missing = false;
119
+ form.find('input[name][required]').each(function() {
120
+ if (!$(this).val()) missing = true;
121
+ });
122
+ return missing;
123
+ }
124
+
125
+ $('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
126
+ var link = $(this);
127
+ if (!allowAction(link)) return false;
128
+
129
+ if (link.attr('data-remote') != undefined) {
130
+ handleRemote(link);
131
+ return false;
132
+ } else if (link.attr('data-method')) {
133
+ handleMethod(link);
134
+ return false;
135
+ }
136
+ });
137
+
138
+ $('form').live('submit.rails', function(e) {
139
+ var form = $(this), remote = form.attr('data-remote') != undefined;
140
+ if (!allowAction(form)) return false;
141
+
142
+ // skip other logic when required values are missing
143
+ if (requiredValuesMissing(form)) return !remote;
144
+
145
+ if (remote) {
146
+ handleRemote(form);
147
+ return false;
148
+ } else {
149
+ // slight timeout so that the submit button gets properly serialized
150
+ setTimeout(function(){ disableFormElements(form) }, 13);
151
+ }
152
+ });
153
+
154
+ $('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
155
+ var button = $(this);
156
+ if (!allowAction(button)) return false;
157
+ // register the pressed submit button
158
+ var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
159
+ button.closest('form').data('ujs:submit-button', data);
160
+ });
161
+
162
+ $('form').live('ajax:beforeSend.rails', function(event) {
163
+ if (this == event.target) disableFormElements($(this));
164
+ });
165
+
166
+ $('form').live('ajax:complete.rails', function(event) {
167
+ if (this == event.target) enableFormElements($(this));
168
+ });
169
+ })( jQuery );